Skip to content

Commit 4f43cf2

Browse files
Merge pull request anomalyco#8 from different-ai/chore/tauri-action-release-workflow
ci: switch macOS release to tauri-action
2 parents aa80c6b + 1117772 commit 4f43cf2

1 file changed

Lines changed: 57 additions & 96 deletions

File tree

Lines changed: 57 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release macOS (Apple Silicon)
1+
name: Release App
22

33
on:
44
push:
@@ -14,14 +14,44 @@ on:
1414
permissions:
1515
contents: write
1616

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
1721
jobs:
18-
release-macos-aarch64:
22+
publish-tauri:
23+
name: Build + Publish (${{ matrix.target }})
1924
runs-on: macos-14
2025
timeout-minutes: 360
2126

27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- target: aarch64-apple-darwin
32+
args: "--target aarch64-apple-darwin --bundles dmg"
33+
- target: x86_64-apple-darwin
34+
args: "--target x86_64-apple-darwin --bundles dmg"
35+
2236
steps:
2337
- name: Checkout
2438
uses: actions/checkout@v4
39+
with:
40+
ref: ${{ inputs.tag || github.ref }}
41+
42+
- name: Set release tag
43+
shell: bash
44+
run: |
45+
set -euo pipefail
46+
47+
TAG_INPUT="${{ inputs.tag }}"
48+
if [ -n "$TAG_INPUT" ]; then
49+
TAG="$TAG_INPUT"
50+
else
51+
TAG="${GITHUB_REF_NAME}"
52+
fi
53+
54+
echo "RELEASE_TAG=$TAG" >> "$GITHUB_ENV"
2555
2656
- name: Setup Node
2757
uses: actions/setup-node@v4
@@ -39,109 +69,40 @@ jobs:
3969
- name: Setup Rust
4070
uses: dtolnay/rust-toolchain@stable
4171
with:
42-
targets: aarch64-apple-darwin
43-
44-
- name: Import Apple signing certificate
45-
env:
46-
APPLE_CODESIGN_CERT_P12_BASE64: ${{ secrets.APPLE_CODESIGN_CERT_P12_BASE64 }}
47-
APPLE_CODESIGN_CERT_PASSWORD: ${{ secrets.APPLE_CODESIGN_CERT_PASSWORD }}
48-
run: |
49-
set -euo pipefail
50-
51-
KEYCHAIN_PATH="$RUNNER_TEMP/openwork-signing.keychain-db"
52-
KEYCHAIN_PASSWORD="$(openssl rand -hex 12)"
53-
54-
echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> "$GITHUB_ENV"
55-
echo "KEYCHAIN_PASSWORD=$KEYCHAIN_PASSWORD" >> "$GITHUB_ENV"
56-
57-
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
58-
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
59-
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
60-
security default-keychain -s "$KEYCHAIN_PATH"
61-
62-
CERT_P12="$RUNNER_TEMP/openwork-certificate.p12"
63-
printf '%s' "$APPLE_CODESIGN_CERT_P12_BASE64" | base64 --decode > "$CERT_P12"
64-
65-
security import "$CERT_P12" \
66-
-k "$KEYCHAIN_PATH" \
67-
-P "$APPLE_CODESIGN_CERT_PASSWORD" \
68-
-A \
69-
-T /usr/bin/codesign \
70-
-T /usr/bin/security
71-
72-
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
73-
security find-identity -v -p codesigning "$KEYCHAIN_PATH"
72+
targets: ${{ matrix.target }}
7473

7574
- name: Write notary API key
7675
env:
7776
APPLE_NOTARY_API_KEY_P8_BASE64: ${{ secrets.APPLE_NOTARY_API_KEY_P8_BASE64 }}
7877
run: |
7978
set -euo pipefail
8079
81-
NOTARY_KEY="$RUNNER_TEMP/AuthKey.p8"
82-
printf '%s' "$APPLE_NOTARY_API_KEY_P8_BASE64" | base64 --decode > "$NOTARY_KEY"
83-
chmod 600 "$NOTARY_KEY"
80+
NOTARY_KEY_PATH="$RUNNER_TEMP/AuthKey.p8"
81+
printf '%s' "$APPLE_NOTARY_API_KEY_P8_BASE64" | base64 --decode > "$NOTARY_KEY_PATH"
82+
chmod 600 "$NOTARY_KEY_PATH"
8483
85-
echo "NOTARY_KEY=$NOTARY_KEY" >> "$GITHUB_ENV"
86-
87-
- name: Build Tauri DMG (Apple Silicon)
84+
- name: Build + upload (tauri-action)
85+
uses: tauri-apps/tauri-action@v0.5.17
8886
env:
89-
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
90-
run: |
91-
set -euo pipefail
92-
93-
pnpm exec tauri build --bundles dmg
87+
CI: true
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9489

95-
DMG_PATH="$(ls -1 "$GITHUB_WORKSPACE/src-tauri/target/release/bundle/dmg/"*.dmg | head -n 1)"
96-
echo "DMG_PATH=$DMG_PATH" >> "$GITHUB_ENV"
97-
echo "Built DMG: $DMG_PATH"
98-
99-
- name: Sign DMG (Developer ID)
100-
env:
90+
# macOS signing (maps from existing repo secrets)
10191
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
102-
run: |
103-
set -euo pipefail
92+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CODESIGN_CERT_P12_BASE64 }}
93+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CODESIGN_CERT_PASSWORD }}
10494

105-
codesign --force --timestamp --sign "$APPLE_SIGNING_IDENTITY" "$DMG_PATH"
106-
107-
- name: Notarize DMG
108-
env:
109-
APPLE_NOTARY_API_KEY_ID: ${{ secrets.APPLE_NOTARY_API_KEY_ID }}
110-
APPLE_NOTARY_API_ISSUER_ID: ${{ secrets.APPLE_NOTARY_API_ISSUER_ID }}
111-
run: |
112-
set -euo pipefail
113-
114-
xcrun notarytool submit "$DMG_PATH" \
115-
--key "$NOTARY_KEY" \
116-
--key-id "$APPLE_NOTARY_API_KEY_ID" \
117-
--issuer "$APPLE_NOTARY_API_ISSUER_ID" \
118-
--wait --timeout 5h
119-
120-
- name: Staple notarization ticket
121-
run: |
122-
set -euo pipefail
123-
124-
xcrun stapler staple "$DMG_PATH"
125-
spctl -a -vv --type open "$DMG_PATH"
126-
127-
- name: Create or update GitHub Release
128-
env:
129-
GH_TOKEN: ${{ github.token }}
130-
run: |
131-
set -euo pipefail
132-
133-
TAG_INPUT="${{ inputs.tag }}"
134-
if [ -n "$TAG_INPUT" ]; then
135-
TAG="$TAG_INPUT"
136-
else
137-
TAG="${GITHUB_REF_NAME}"
138-
fi
139-
140-
LABEL="OpenWork macOS (Apple Silicon)"
141-
ASSET="${DMG_PATH}#${LABEL}"
142-
143-
if gh release view "$TAG" >/dev/null 2>&1; then
144-
gh release upload "$TAG" "$ASSET" --clobber
145-
else
146-
gh release create "$TAG" "$ASSET" --title "OpenWork $TAG" --generate-notes --verify-tag
147-
fi
95+
# macOS notarization (App Store Connect API key)
96+
APPLE_API_KEY: ${{ secrets.APPLE_NOTARY_API_KEY_ID }}
97+
APPLE_API_ISSUER: ${{ secrets.APPLE_NOTARY_API_ISSUER_ID }}
98+
APPLE_API_KEY_PATH: ${{ runner.temp }}/AuthKey.p8
99+
with:
100+
tagName: ${{ env.RELEASE_TAG }}
101+
releaseName: OpenWork ${{ env.RELEASE_TAG }}
102+
releaseBody: See the assets to download this version and install.
103+
releaseDraft: false
104+
prerelease: false
105+
projectPath: .
106+
tauriScript: pnpm exec tauri -vvv
107+
args: ${{ matrix.args }}
108+
retryAttempts: 3

0 commit comments

Comments
 (0)