Repository navigation
164 lines (139 loc) · 6.06 KB
/
Copy pathrelease.yml
File metadata and controls
164 lines (139 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build-and-release:
runs-on: macos-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
# A release must ship the model; stop before any signing secrets are used.
- name: Check model bundle
run: make release-preflight
- name: Resolve release version
id: version
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Release tags must use semantic versioning, for example v0.3.1." >&2
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Stamp app version
run: |
plutil -replace CFBundleShortVersionString -string "${{ steps.version.outputs.version }}" Info.plist
plutil -replace CFBundleVersion -string "${{ github.run_number }}" Info.plist
plutil -replace FreeFlowBuildTag -string "${{ steps.version.outputs.tag }}" Info.plist
- name: Build release notes from changelog
id: release_notes
run: |
.github/scripts/changelog-section.sh "${{ steps.version.outputs.version }}" > "$RUNNER_TEMP/release-notes.md"
{
echo "body<<EOF"
cat "$RUNNER_TEMP/release-notes.md"
echo
echo "## Download"
echo
echo "**[LocalFlow.dmg](https://github.com/ajbarryiii/LocalFlow/releases/download/${{ steps.version.outputs.tag }}/LocalFlow.dmg)** — For Apple Silicon Macs on macOS 26 or later."
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Install build tools
run: |
if brew tap | grep -qx 'aws/tap'; then
brew untap aws/tap
fi
brew install create-dmg fileicon
# --- Code signing setup ---
# Required GitHub secrets:
# DEVELOPER_ID_CERTIFICATE_BASE64 — base64-encoded .p12 Developer ID certificate
# DEVELOPER_ID_CERTIFICATE_PASSWORD — password for the .p12
# APPLE_ID — Apple ID email for notarization
# APPLE_TEAM_ID — 10-character Apple Team ID
# APPLE_APP_PASSWORD — app-specific password for notarization
- name: Import Developer ID certificate
env:
CERTIFICATE_BASE64: ${{ secrets.DEVELOPER_ID_CERTIFICATE_BASE64 }}
CERTIFICATE_PASSWORD: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }}
run: |
CERTIFICATE_PATH="$RUNNER_TEMP/developer_id.p12"
KEYCHAIN_PATH="$RUNNER_TEMP/signing.keychain-db"
KEYCHAIN_PASSWORD="$(openssl rand -hex 20)"
# Decode certificate
echo "$CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH"
# Create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Import certificate and delete .p12 from disk immediately
security import "$CERTIFICATE_PATH" \
-P "$CERTIFICATE_PASSWORD" \
-A \
-t cert \
-f pkcs12 \
-k "$KEYCHAIN_PATH"
rm -f "$CERTIFICATE_PATH"
# Allow codesign to access the keychain without UI prompt
security set-key-partition-list -S apple-tool:,apple:,codesign: \
-s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
# Add temporary keychain to search list
security list-keychains -d user -s "$KEYCHAIN_PATH" $(security list-keychains -d user | tr -d '"')
# Extract signing identity
IDENTITY=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo "CODESIGN_IDENTITY=$IDENTITY" >> "$GITHUB_ENV"
echo "KEYCHAIN_PATH=$KEYCHAIN_PATH" >> "$GITHUB_ENV"
echo "Found signing identity: $IDENTITY"
- name: Store notarization credentials
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
run: |
xcrun notarytool store-credentials "notarytool-profile" \
--apple-id "$APPLE_ID" \
--team-id "$APPLE_TEAM_ID" \
--password "$APPLE_APP_PASSWORD" \
--keychain "$KEYCHAIN_PATH"
# --- Build universal ---
- name: Build
run: make ARCH=arm64 APP_NAME=LocalFlow BUNDLE_ID=com.ajbarryiii.localflow CODESIGN_IDENTITY="$CODESIGN_IDENTITY"
- name: Create DMG
run: make dmg ARCH=arm64 APP_NAME=LocalFlow BUNDLE_ID=com.ajbarryiii.localflow CODESIGN_IDENTITY="$CODESIGN_IDENTITY"
- name: Sign DMG
run: codesign --force --sign "$CODESIGN_IDENTITY" build/LocalFlow.dmg
- name: Notarize universal DMG
run: |
xcrun notarytool submit build/LocalFlow.dmg \
--keychain-profile "notarytool-profile" \
--keychain "$KEYCHAIN_PATH" \
--wait
xcrun stapler staple build/LocalFlow.dmg
- name: Save universal DMG
run: mv build/LocalFlow.dmg LocalFlow.dmg
# --- Release ---
- name: Create Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: LocalFlow ${{ steps.version.outputs.version }}
body: ${{ steps.release_notes.outputs.body }}
generate_release_notes: false
make_latest: true
files: |
LocalFlow.dmg
# --- Cleanup ---
- name: Cleanup signing artifacts
if: always()
run: |
rm -f "$RUNNER_TEMP/developer_id.p12"
KPATH="${KEYCHAIN_PATH:-$RUNNER_TEMP/signing.keychain-db}"
if [ -f "$KPATH" ]; then
security delete-keychain "$KPATH"
fi