Skip to content

Commit 57a479f

Browse files
niikCopilot
andcommitted
Update deep-dive doc for final release workflow state
Bring the release deep-dive in line with the final branch state: site steps gated on production, createrepo/reprepro gate on environment instead of GPG_SIGN, dropped github.token fallback, quoted keychain paths, and documented the script/release --dry-run default. Also restore the reprepro env: key that was dropped when GPG_SIGN was removed, which had left the workflow YAML invalid. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9cde87c commit 57a479f

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

.github/workflows/deployment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ jobs:
404404
popd
405405
- name: Run reprepro
406406
if: ${{ inputs.environment == 'production' }}
407+
env:
407408
# We are no longer adding to the distribution list.
408409
# All apt distributions should use "stable" according to our install documentation.
409410
# In the future we will remove legacy distributions listed here.

docs/release-process-deep-dive.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -243,28 +243,28 @@ In order to perform signing, a keychain must be configured with the signing cert
243243
PW=pwd.${{ github.run_number }}
244244
245245
# Create a new keychain for credentials to be stored in.
246-
security create-keychain -p $PW $RUNNER_TEMP/build.keychain
246+
security create-keychain -p $PW "$RUNNER_TEMP/build.keychain"
247247
# Raise the keychain auto-lock timeout (6 hours) so it does not lock mid-build.
248248
security set-keychain-settings -lut 21600 "$RUNNER_TEMP/build.keychain"
249249
# Mark the keychain as the system default so that a later signing step doesn't require
250250
# referencing the keychain by name.
251-
security default-keychain -s $RUNNER_TEMP/build.keychain
251+
security default-keychain -s "$RUNNER_TEMP/build.keychain"
252252
# Unlock the keychain so that future operations can access the secrets without user interaction.
253-
security unlock-keychain -p $PW $RUNNER_TEMP/build.keychain
253+
security unlock-keychain -p $PW "$RUNNER_TEMP/build.keychain"
254254
255255
# Decode the base64-encoded certificate secret into a .p12 file. The
256256
# certificate and password are passed in via the DEVELOPER_ID_CERT and
257257
# DEVELOPER_ID_CERT_PASSWORD env vars (mapped from secrets) rather than
258258
# interpolated into the script, so a password containing shell
259259
# metacharacters cannot break quoting or be injected.
260-
base64 -d <<<"$DEVELOPER_ID_CERT" > $RUNNER_TEMP/cert.p12
260+
base64 -d <<<"$DEVELOPER_ID_CERT" > "$RUNNER_TEMP/cert.p12"
261261
262262
# Import the certificate into the keychain so that a later signing step can use it.
263263
# `man security` snippet:
264264
# -k keychain Specify keychain into which item(s) will be imported.
265265
# -P passphrase Specify the unwrapping passphrase immediately. The default is to obtain a secure passphrase via GUI.
266266
# -T appPath Specify an application which may access the imported key (multiple -T options are allowed)
267-
security import $RUNNER_TEMP/cert.p12 -k $RUNNER_TEMP/build.keychain -P "$DEVELOPER_ID_CERT_PASSWORD" -T /usr/bin/codesign
267+
security import "$RUNNER_TEMP/cert.p12" -k "$RUNNER_TEMP/build.keychain" -P "$DEVELOPER_ID_CERT_PASSWORD" -T /usr/bin/codesign
268268

269269
# Enforce additional security requirements that only the applications used for signing can access the keychain. This allows for signing applications to access the keychain without user interaction.
270270
# The three values:
@@ -280,9 +280,9 @@ security import $RUNNER_TEMP/cert.p12 -k $RUNNER_TEMP/build.keychain -P "$DEVELO
280280
# Comma-separated partition list. See output of "security dump-keychain" for examples.
281281
# -k password Password for keychain
282282
# -s Match keys that can sign
283-
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $PW $RUNNER_TEMP/build.keychain
283+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $PW "$RUNNER_TEMP/build.keychain"
284284
# Clean up the certificate so that it's not lying around for later steps to leak.
285-
rm $RUNNER_TEMP/cert.p12
285+
rm "$RUNNER_TEMP/cert.p12"
286286
```
287287

288288
> [!NOTE]
@@ -499,16 +499,15 @@ release:
499499
owner: github
500500
repositories: cli.github.com
501501
- name: Checkout documentation site
502+
if: ${{ inputs.environment == 'production' }}
502503
uses: actions/checkout@v4
503504
with:
504505
repository: github/cli.github.com
505506
path: site
506507
fetch-depth: 0
507-
# In non-production environments the App token step is skipped, so
508-
# fall back to github.token for anonymous read access to the public
509-
# cli.github.com repo (push is gated separately on DO_PUBLISH).
510-
token: ${{ steps.site-deploy-token.outputs.token || github.token }}
508+
token: ${{ steps.site-deploy-token.outputs.token }}
511509
- name: Update site man pages
510+
if: ${{ inputs.environment == 'production' }}
512511
env:
513512
GIT_COMMITTER_NAME: cli automation
514513
GIT_AUTHOR_NAME: cli automation
@@ -557,26 +556,24 @@ release:
557556
with:
558557
subject-path: "dist/gh_*"
559558
- name: Run createrepo
560-
env:
561-
GPG_SIGN: ${{ inputs.environment == 'production' }}
559+
if: ${{ inputs.environment == 'production' }}
562560
run: |
563561
mkdir -p site/packages/rpm
564562
cp dist/*.rpm site/packages/rpm/
565563
./script/createrepo.sh
566564
cp -r dist/repodata site/packages/rpm/
567565
pushd site/packages/rpm
568-
[ "$GPG_SIGN" = "false" ] || gpg --yes --detach-sign --armor repodata/repomd.xml
566+
gpg --yes --detach-sign --armor repodata/repomd.xml
569567
popd
570568
- name: Run reprepro
569+
if: ${{ inputs.environment == 'production' }}
571570
env:
572-
GPG_SIGN: ${{ inputs.environment == 'production' }}
573571
# We are no longer adding to the distribution list.
574572
# All apt distributions should use "stable" according to our install documentation.
575573
# In the future we will remove legacy distributions listed here.
576574
RELEASES: "cosmic eoan disco groovy focal stable oldstable testing sid unstable buster bullseye stretch jessie bionic trusty precise xenial hirsute impish kali-rolling"
577575
run: |
578576
mkdir -p upload
579-
[ "$GPG_SIGN" = "true" ] || sed -i.bak '/^SignWith:/d' script/distributions
580577
for release in $RELEASES; do
581578
for file in dist/*.deb; do
582579
reprepro --confdir="+b/script" includedeb "$release" "$file"
@@ -636,7 +633,7 @@ The following sections are not strictly in the same order as the workflow but in
636633

637634
A git commit is created in the `cli.github.com` site repository containing the contents of the CLI Manual uploaded by the [`linux`](#linux) job. This is not pushed until the package repository artifacts are set up later.
638635

639-
The `cli.github.com` repository is checked out using a short-lived GitHub App installation token rather than a long-lived PAT. The `Generate site deploy token` step (which only runs when `inputs.environment == 'production'`) uses [`actions/create-github-app-token`](https://github.com/actions/create-github-app-token) with the `SITE_DEPLOY_APP_CLIENT_ID` / `SITE_DEPLOY_APP_PRIVATE_KEY` secrets to mint a token scoped to the `github/cli.github.com` repository, replacing the previous `SITE_DEPLOY_PAT` secret. In non-production environments the token step is skipped and the checkout falls back to `github.token` for anonymous read access (`token: ${{ steps.site-deploy-token.outputs.token || github.token }}`); pushing to the site is gated separately (see [Publishing behaviour and dry runs](#dry-run)).
636+
The `cli.github.com` repository is checked out using a short-lived GitHub App installation token rather than a long-lived PAT. The `Generate site deploy token` step (which only runs when `inputs.environment == 'production'`) uses [`actions/create-github-app-token`](https://github.com/actions/create-github-app-token) with the `SITE_DEPLOY_APP_CLIENT_ID` / `SITE_DEPLOY_APP_PRIVATE_KEY` secrets to mint a token scoped to the `github/cli.github.com` repository, replacing the previous `SITE_DEPLOY_PAT` secret. The site-related steps (`Checkout documentation site`, `Update site man pages`, `Run createrepo`, `Run reprepro`, and `Publish site`) are all guarded by `if: inputs.environment == 'production'`, so in non-production environments the site is neither checked out nor mutated. Even in production, pushing to the site is gated separately on `DO_PUBLISH` (see [Publishing behaviour and dry runs](#dry-run)).
640637

641638
### Site Package Repositories
642639

@@ -719,6 +716,9 @@ The `Create the release` and `Publish site` steps consult their `DO_PUBLISH` env
719716

720717
To make dry runs easy to spot in the Actions UI, the workflow's `run-name` appends a `(dry run)` suffix when `inputs.dry_run` is `true` (`run-name: ${{ inputs.tag_name }} / ${{ inputs.environment }}${{ inputs.dry_run == true && ' (dry run)' || '' }}`).
721718

719+
> [!IMPORTANT]
720+
> The default value of `dry_run` differs depending on how the workflow is triggered. On the `workflow_dispatch` form it defaults to `true`, so a manually triggered run is a dry run unless you explicitly untick the box. `./script/release` takes the opposite default: it defaults `dry_run` to `false` and only forwards `dry_run=true` when invoked with the `--dry-run` flag (`script/release [--staging] [--dry-run] <tag-name> ...`). In other words, `./script/release <tag-name>` performs a real release, while `./script/release --dry-run <tag-name>` exercises the full pipeline without publishing.
721+
722722
## <a id="deepest-dive">Deepest Dive</a>
723723

724724
### <a id="how-script-release-works">How script/release works</a>

0 commit comments

Comments
 (0)