Skip to content

Commit 4663829

Browse files
committed
ci: release: add MacOS signing
Add signing of the MacOS release binaries. Signed-off-by: Jordan Yates <[email protected]>
1 parent 5956fda commit 4663829

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ permissions:
44
contents: write
55

66
on:
7+
pull_request:
8+
types: [ labeled ]
79
push:
810
tags:
911
- v[0-9]+.*
@@ -13,13 +15,16 @@ jobs:
1315
runs-on: ubuntu-latest
1416
steps:
1517
- uses: actions/checkout@v4
18+
if: ${{ github.event_name == 'push' }}
1619
- uses: taiki-e/create-gh-release-action@v1
20+
if: ${{ github.event_name == 'push' }}
1721
with:
1822
# (optional) Path to changelog.
1923
changelog: CHANGELOG.md
2024
# (required) GitHub token for creating GitHub Releases.
2125
token: ${{ secrets.GITHUB_TOKEN }}
2226
upload-assets:
27+
if: ${{ (github.event_name == 'push') || (github.event.label.name == 'release') }}
2328
needs: create-release
2429
strategy:
2530
matrix:
@@ -38,6 +43,20 @@ jobs:
3843
runs-on: ${{ matrix.os }}
3944
steps:
4045
- uses: actions/checkout@v4
46+
- name: MacOS Signing setup
47+
if: runner.os == 'macOS'
48+
shell: bash
49+
run: |
50+
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
51+
security create-keychain -p "" build.keychain
52+
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
53+
security list-keychains -s build.keychain
54+
security default-keychain -s build.keychain
55+
security unlock-keychain -p "" build.keychain
56+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "" build.keychain
57+
env:
58+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
59+
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
4160
- uses: taiki-e/upload-rust-binary-action@v1
4261
with:
4362
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
@@ -49,3 +68,8 @@ jobs:
4968
target: ${{ matrix.target }}
5069
# (required) GitHub token for uploading assets to GitHub Releases.
5170
token: ${{ secrets.GITHUB_TOKEN }}
71+
# Dry-run unless a release
72+
dry-run: ${{ github.event_name != 'push' }}
73+
# MacOS codesign parameters
74+
codesign: $${{ secrets.MACOS_SIGNING_IDENTITY }}
75+
codesign-options: runtime

0 commit comments

Comments
 (0)