Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 129 additions & 2 deletions .github/workflows/release-sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ name: release-sign
# sign-sparkle macOS. Signs the installer for Sparkle.
# publish macOS. Publishes the installer.
#
# Each job records the SHA-256 of what it uploads as a job output, and the job that downloads
# it checks the file against that before using it.
#
# The three signing jobs run in the "signing" environment, which only main and
# v* tags may use. The publish job runs in the "publish" environment, under
# the same restriction. Neither environment has reviewers, so that preview
Expand Down Expand Up @@ -64,6 +67,9 @@ jobs:
if: ${{ github.repository_owner == 'coder' }}
permissions:
contents: read
outputs:
app-sha256: ${{ steps.checksums.outputs.app }}
dsyms-sha256: ${{ steps.checksums.outputs.dsyms }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -84,6 +90,17 @@ jobs:
shell: nix develop .#ci --command bash --noprofile --norc -eo pipefail {0}
run: ./scripts/build.sh build/release

- name: Record checksums
id: checksums
run: |
set -euo pipefail
app="$(shasum -a 256 build/release/coder-desktop-unsigned.tar | cut -d ' ' -f 1)"
dsyms="$(shasum -a 256 build/release/coder-desktop-dsyms.zip | cut -d ' ' -f 1)"
{
echo "app=$app"
echo "dsyms=$dsyms"
} >> "$GITHUB_OUTPUT"

- name: Upload unsigned app
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand All @@ -109,6 +126,8 @@ jobs:
if: ${{ github.repository_owner == 'coder' }}
permissions:
contents: read
outputs:
sha256: ${{ steps.checksum.outputs.sha256 }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -118,6 +137,13 @@ jobs:
- name: Build rcodesign
uses: ./.github/actions/install-rcodesign

- name: Record checksum
id: checksum
run: |
set -euo pipefail
sha256="$(sha256sum /tmp/rcodesign-bin/rcodesign | cut -d ' ' -f 1)"
echo "sha256=$sha256" >> "$GITHUB_OUTPUT"

- name: Upload rcodesign
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand Down Expand Up @@ -157,6 +183,8 @@ jobs:
contents: read
# To authenticate to Google Cloud
id-token: write
outputs:
sha256: ${{ steps.checksum.outputs.sha256 }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -171,6 +199,14 @@ jobs:
name: rcodesign
path: ${{ runner.temp }}/rcodesign

- name: Check rcodesign
env:
SHA256: ${{ needs.rcodesign.outputs.sha256 }}
run: |
set -euo pipefail
[[ "$SHA256" =~ ^[0-9a-f]{64}$ ]] || { echo "::error::No checksum from the rcodesign job."; exit 1; }
sha256sum -c <<<"$SHA256 $RUNNER_TEMP/rcodesign/rcodesign"

- name: Install rcodesign
run: |
set -euo pipefail
Expand Down Expand Up @@ -252,6 +288,14 @@ jobs:
name: unsigned-app
path: build/unsigned

- name: Check unsigned app
env:
SHA256: ${{ needs.build.outputs.app-sha256 }}
run: |
set -euo pipefail
[[ "$SHA256" =~ ^[0-9a-f]{64}$ ]] || { echo "::error::No checksum from the build job."; exit 1; }
sha256sum -c <<<"$SHA256 build/unsigned/coder-desktop-unsigned.tar"

- name: Sign
env:
APP_PROF_PATH: /tmp/app.provisionprofile
Expand Down Expand Up @@ -284,6 +328,13 @@ jobs:
"build/app/Coder Desktop.app"
tar -C build/app -cf build/coder-desktop-signed.tar "Coder Desktop.app"

- name: Record checksum
id: checksum
run: |
set -euo pipefail
sha256="$(sha256sum build/coder-desktop-signed.tar | cut -d ' ' -f 1)"
echo "sha256=$sha256" >> "$GITHUB_OUTPUT"

- name: Upload signed app
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand All @@ -302,6 +353,8 @@ jobs:
if: ${{ !cancelled() && github.repository_owner == 'coder' && needs.sign-app.result == 'success' }}
permissions:
contents: read
outputs:
sha256: ${{ steps.checksum.outputs.sha256 }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -314,6 +367,14 @@ jobs:
name: signed-app
path: build/signed

- name: Check signed app
env:
SHA256: ${{ needs.sign-app.outputs.sha256 }}
run: |
set -euo pipefail
[[ "$SHA256" =~ ^[0-9a-f]{64}$ ]] || { echo "::error::No checksum from the sign-app job."; exit 1; }
shasum -a 256 -c <<<"$SHA256 build/signed/coder-desktop-signed.tar"

# The installer comes out unsigned. The sign-installer job signs it.
- name: Build the installer
run: |
Expand All @@ -329,6 +390,13 @@ jobs:
--install-location "/Applications/" \
build/package/Coder-Desktop.pkg

- name: Record checksum
id: checksum
run: |
set -euo pipefail
sha256="$(shasum -a 256 build/package/Coder-Desktop.pkg | cut -d ' ' -f 1)"
echo "sha256=$sha256" >> "$GITHUB_OUTPUT"

- name: Upload unsigned installer
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand All @@ -349,6 +417,8 @@ jobs:
contents: read
# To authenticate to Google Cloud
id-token: write
outputs:
sha256: ${{ steps.checksum.outputs.sha256 }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -362,6 +432,14 @@ jobs:
name: rcodesign
path: ${{ runner.temp }}/rcodesign

- name: Check rcodesign
env:
SHA256: ${{ needs.rcodesign.outputs.sha256 }}
run: |
set -euo pipefail
[[ "$SHA256" =~ ^[0-9a-f]{64}$ ]] || { echo "::error::No checksum from the rcodesign job."; exit 1; }
sha256sum -c <<<"$SHA256 $RUNNER_TEMP/rcodesign/rcodesign"

- name: Install rcodesign
run: |
set -euo pipefail
Expand Down Expand Up @@ -434,6 +512,14 @@ jobs:
name: unsigned-installer
path: build/package

- name: Check unsigned installer
env:
SHA256: ${{ needs.package.outputs.sha256 }}
run: |
set -euo pipefail
[[ "$SHA256" =~ ^[0-9a-f]{64}$ ]] || { echo "::error::No checksum from the package job."; exit 1; }
sha256sum -c <<<"$SHA256 build/package/Coder-Desktop.pkg"

- name: Sign
env:
AC_CERTIFICATE_FILE: /tmp/installer_cert.pem
Expand Down Expand Up @@ -462,6 +548,13 @@ jobs:
--staple \
build/out/Coder-Desktop.pkg

- name: Record checksum
id: checksum
run: |
set -euo pipefail
sha256="$(sha256sum build/out/Coder-Desktop.pkg | cut -d ' ' -f 1)"
echo "sha256=$sha256" >> "$GITHUB_OUTPUT"

- name: Upload installer
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand All @@ -486,13 +579,23 @@ jobs:
# See the sign-app job.
environment: signing
permissions: {}
outputs:
sha256: ${{ steps.checksum.outputs.sha256 }}
steps:
- name: Download installer
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: installer
path: build/out

- name: Check installer
env:
SHA256: ${{ needs.sign-installer.outputs.sha256 }}
run: |
set -euo pipefail
[[ "$SHA256" =~ ^[0-9a-f]{64}$ ]] || { echo "::error::No checksum from the sign-installer job."; exit 1; }
shasum -a 256 -c <<<"$SHA256 build/out/Coder-Desktop.pkg"

# The tool comes from the Sparkle release the app is built with.
- name: Install Sparkle's signing tool
run: |
Expand All @@ -517,6 +620,13 @@ jobs:
> build/out/Coder-Desktop.pkg.sig
cat build/out/Coder-Desktop.pkg.sig

- name: Record checksum
id: checksum
run: |
set -euo pipefail
sha256="$(shasum -a 256 build/out/Coder-Desktop.pkg.sig | cut -d ' ' -f 1)"
echo "sha256=$sha256" >> "$GITHUB_OUTPUT"

- name: Upload Sparkle signature
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
Expand All @@ -529,11 +639,12 @@ jobs:
# identity that may write to the releases bucket.
publish:
name: Publish
needs: [build, sign-sparkle]
needs: [build, sign-installer, sign-sparkle]
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-26' || 'macos-26'}}
if: >-
${{ !cancelled() && github.repository_owner == 'coder' &&
needs.build.result == 'success' && needs.sign-sparkle.result == 'success' }}
needs.build.result == 'success' && needs.sign-installer.result == 'success' &&
needs.sign-sparkle.result == 'success' }}
environment: publish
permissions:
# To upload assets to the release
Expand Down Expand Up @@ -572,6 +683,22 @@ jobs:
name: dsyms
path: build/out

- name: Check downloads
env:
INSTALLER_SHA256: ${{ needs.sign-installer.outputs.sha256 }}
SIGNATURE_SHA256: ${{ needs.sign-sparkle.outputs.sha256 }}
DSYMS_SHA256: ${{ needs.build.outputs.dsyms-sha256 }}
run: |
set -euo pipefail
for sha256 in "$INSTALLER_SHA256" "$SIGNATURE_SHA256" "$DSYMS_SHA256"; do
[[ "$sha256" =~ ^[0-9a-f]{64}$ ]] || { echo "::error::A checksum from an earlier job is missing."; exit 1; }
done
shasum -a 256 -c <<EOF
$INSTALLER_SHA256 build/out/Coder-Desktop.pkg
$SIGNATURE_SHA256 build/out/Coder-Desktop.pkg.sig
$DSYMS_SHA256 build/out/coder-desktop-dsyms.zip
EOF

# Upload as artifact in dry-run mode
- name: Upload Build Artifact
if: ${{ inputs.dryrun }}
Expand Down
4 changes: 4 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ alternate between the two:
| `sign-sparkle` | macOS | Signs the installer for Sparkle |
| `publish` | macOS | Publishes the installer and updates the appcast |

The jobs pass files to each other as workflow artifacts. Each job records the
SHA-256 of what it uploads, and the job that downloads it checks the file
against that before using it.

The scripts are in `scripts/signing`. `sign-app.sh` reproduces what Xcode's
Developer ID export used to do. It also signs the two macOS programs inside
`mutagen-agents.tar.gz`, which signing the app bundle does not reach.
Expand Down
Loading