-
-
Notifications
You must be signed in to change notification settings - Fork 47
169 lines (145 loc) · 5.77 KB
/
Copy pathrelease.yml
File metadata and controls
169 lines (145 loc) · 5.77 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
165
166
167
168
169
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version number (e.g. 0.1.0)"
required: false
default: "0.0.0-dev"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
runs-on: macos-26
environment: Prod
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install create-dmg
run: brew install create-dmg
- name: Install Tuist via mise
uses: jdx/mise-action@v2
with:
install: true
- name: Import signing certificate
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.SIGNING_CERTIFICATE_P12 }}
p12-password: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
- name: Write Signing.xcconfig
run: |
cat > Configurations/Signing.xcconfig << EOF
MOEPEEK_CODE_SIGN_STYLE = Manual
MOEPEEK_CODE_SIGN_IDENTITY = ${{ secrets.SIGNING_IDENTITY }}
MOEPEEK_DEVELOPMENT_TEAM = ${{ secrets.DEVELOPMENT_TEAM }}
SPARKLE_ED_PUBLIC_KEY = ${{ secrets.SPARKLE_ED_PUBLIC_KEY }}
EOF
- name: Resolve dependencies and generate project
run: tuist install && tuist generate
- name: Determine version
id: version
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#v}"
else
VERSION="${{ github.event.inputs.version || '0.0.0-dev' }}"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Archive
run: |
xcodebuild archive \
-workspace MoePeek.xcworkspace \
-scheme MoePeek \
-configuration Release \
-archivePath build/MoePeek.xcarchive \
VALIDATE_STRINGS_FILES_WHILE_COPYING=NO \
MARKETING_VERSION=${{ steps.version.outputs.version }} \
CURRENT_PROJECT_VERSION=${{ github.run_number }}
- name: Verify code signature
run: |
APP="build/MoePeek.xcarchive/Products/Applications/MoePeek.app"
codesign --verify --strict "$APP"
SIGN_INFO=$(codesign -dvvv "$APP" 2>&1)
echo "$SIGN_INFO" | grep -E "Authority|Identifier|TeamIdentifier"
if echo "$SIGN_INFO" | grep -q "TeamIdentifier=not set"; then
echo "::error::Code signature has no TeamIdentifier (ad-hoc signing). Check SIGNING_IDENTITY and SIGNING_CERTIFICATE secrets."
exit 1
fi
- name: Prepare app bundle
run: |
mkdir -p build/app
cp -R build/MoePeek.xcarchive/Products/Applications/MoePeek.app build/app/
- name: Create ZIP
run: |
ditto -c -k --sequesterRsrc --keepParent build/app/MoePeek.app \
"MoePeek-v${{ steps.version.outputs.version }}-macOS.zip"
- name: Package PopClip Extension
run: |
ditto -c -k --sequesterRsrc --keepParent \
PopClipExtension/MoePeek.popclipext \
"MoePeek.popclipext.zip"
- name: Check Sparkle signing key
id: sparkle
run: |
if [ -n "$SPARKLE_KEY" ]; then
echo "has_key=true" >> "$GITHUB_OUTPUT"
fi
env:
SPARKLE_KEY: ${{ secrets.SPARKLE_ED_PRIVATE_KEY }}
- name: Download Sparkle CLI tools
if: steps.sparkle.outputs.has_key == 'true'
run: |
SPARKLE_VERSION=$(python3 -c "import json; pins=json.load(open('Package.resolved'))['pins']; print(next(p['state']['version'] for p in pins if p['identity']=='sparkle'))")
echo "Using Sparkle CLI v${SPARKLE_VERSION} (from Package.resolved)"
mkdir -p /tmp/sparkle
curl -sL "https://github.com/sparkle-project/Sparkle/releases/download/${SPARKLE_VERSION}/Sparkle-${SPARKLE_VERSION}.tar.xz" | tar xJ -C /tmp/sparkle
- name: Create DMG
run: |
create-dmg \
--volname "MoePeek" \
--window-pos 200 120 \
--window-size 660 400 \
--icon-size 160 \
--icon "MoePeek.app" 180 170 \
--app-drop-link 480 170 \
--hide-extension "MoePeek.app" \
"MoePeek-v${{ steps.version.outputs.version }}-macOS.dmg" \
build/app/ \
|| test $? -eq 1
- name: Generate appcast
if: steps.sparkle.outputs.has_key == 'true'
env:
SPARKLE_ED_PRIVATE_KEY: ${{ secrets.SPARKLE_ED_PRIVATE_KEY }}
run: |
mkdir -p build/release
cp "MoePeek-v${{ steps.version.outputs.version }}-macOS.zip" build/release/
# Download existing appcast to preserve history (skip if first release or invalid)
curl -sfL "https://github.com/cosZone/MoePeek/releases/latest/download/appcast.xml" \
-o appcast.xml || rm -f appcast.xml
DOWNLOAD_URL="https://github.com/cosZone/MoePeek/releases/download/v${{ steps.version.outputs.version }}"
/tmp/sparkle/bin/generate_appcast \
--ed-key-file <(echo "$SPARKLE_ED_PRIVATE_KEY") \
--download-url-prefix "$DOWNLOAD_URL/" \
-o appcast.xml \
build/release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: v${{ steps.version.outputs.version }}
draft: ${{ github.event_name == 'workflow_dispatch' }}
generate_release_notes: true
files: |
MoePeek-v${{ steps.version.outputs.version }}-macOS.zip
MoePeek-v${{ steps.version.outputs.version }}-macOS.dmg
MoePeek.popclipext.zip
appcast.xml