forked from MrKai77/Loop
-
Notifications
You must be signed in to change notification settings - Fork 0
233 lines (202 loc) Β· 8.37 KB
/
dev-build.yml
File metadata and controls
233 lines (202 loc) Β· 8.37 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
name: Development Build
on:
workflow_dispatch:
inputs:
release-new-build:
type: boolean
default: false
description: 'Release new dev build'
required: true
jobs:
pre-release:
name: Development Build
runs-on: macos-26
permissions:
contents: write
pull-requests: write
steps:
- name: β¬οΈ Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: π§ͺ Set Version and Build number
run: |
# CHANGE EVERY RELEASE:
APP_VERSION="π§ͺ 1.4.1"
APP_BUILD=$(git rev-list --count HEAD)
FROM_TAG=$(git describe --tags --abbrev=0 --exclude='prerelease')
# Set VERSION
latest_tag=$APP_VERSION
echo "Latest tag: $latest_tag"
sed -i -e "/VERSION =/ s/= .*/= $latest_tag/" Loop/Config.xcconfig
# Set BUILD_NUMBER
latest_commit_number=$APP_BUILD
echo "Latest commit number: $latest_commit_number"
sed -i -e "/BUILD_NUMBER =/ s/= .*/= $latest_commit_number/" Loop/Config.xcconfig
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
echo "APP_BUILD=$APP_BUILD" >> $GITHUB_ENV
echo "FROM_TAG=$FROM_TAG" >> $GITHUB_ENV
- name: π§ Select Xcode
run: sudo xcode-select -s "/Applications/Xcode_26.2.app"
- name: ποΈ Install Development & Developer ID Certificate
env:
DEVELOPMENT_CERT_BASE64: ${{ secrets.DEVELOPMENT_CERT_BASE64 }}
DEVELOPER_ID_CERT_BASE64: ${{ secrets.DEVELOPER_ID_CERT_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
DEVELOPMENT_CERT_PATH=$RUNNER_TEMP/dev.p12
DEVELOPER_ID_CERT_PATH=$RUNNER_TEMP/devid.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$DEVELOPMENT_CERT_BASE64" | base64 --decode -o $DEVELOPMENT_CERT_PATH
echo -n "$DEVELOPER_ID_CERT_BASE64" | base64 --decode -o $DEVELOPER_ID_CERT_PATH
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security import $DEVELOPMENT_CERT_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $DEVELOPER_ID_CERT_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: ποΈ Install Provision Profile
if: false
env:
PROVISION_PROFILE_BASE64: ${{ secrets.PROVISION_PROFILE_BASE64 }}
run: |
PP_PATH=$RUNNER_TEMP/Loop.provisionprofile
echo -n "$PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: π οΈ Build Loop
run: |
set -o pipefail && xcodebuild \
archive \
-project Loop.xcodeproj/ \
-scheme "Loop (GH ACTIONS)" \
-destination 'generic/platform=macOS' \
-archivePath dist/Loop.xcarchive \
-allowProvisioningUpdates \
-skipMacroValidation \
-skipPackagePluginValidation \
-showBuildTimingSummary \
| xcbeautify
- name: π₯‘ Export Loop.app
run: |
xcodebuild \
-exportArchive \
-archivePath dist/Loop.xcarchive \
-exportPath dist/ \
-exportOptionsPlist assets/ExportOptions.plist \
-allowProvisioningUpdates
- name: π€ Compress Loop for notarization
run: |
ditto -c -k --sequesterRsrc --keepParent "dist/Loop.app" "dist/Loop.zip"
- name: β
Notarize Loop
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PWD: ${{ secrets.APPLE_ID_PWD }}
run: |
xcrun notarytool store-credentials Loop --apple-id "$APPLE_ID" --team-id "$APPLE_TEAM_ID" --password "$APPLE_ID_PWD"
xcrun notarytool submit "dist/Loop.zip" --keychain-profile "Loop" --wait
xcrun stapler staple "dist/Loop.app"
- name: π€ Compress notarized Loop
run: |
rm dist/Loop.zip
ditto -c -k --sequesterRsrc --keepParent "dist/Loop.app" "dist/Loop.zip"
- name: β¬οΈ Upload Loop
uses: actions/upload-artifact@v4
with:
name: Loop
path: dist/Loop.zip
- name: π¬ Comment on PR with build link
if: "${{ !inputs.release-new-build }}"
uses: actions/github-script@v7
with:
script: |
const branch = context.ref.replace('refs/heads/', '');
// Find PRs for this branch
const { data: pulls } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
head: `${context.repo.owner}:${branch}`
});
if (pulls.length === 0) {
console.log(`No open PR found for branch: ${branch}`);
return;
}
const pr = pulls[0];
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const body = [
'π§ **Development Build Finished**',
'',
`- Version: ${process.env.APP_VERSION} (${process.env.APP_BUILD})`,
`- Workflow: [View build logs & artifacts](${runUrl})`
].join('\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
body
});
console.log(`Commented on PR #${pr.number}`);
- name: π·οΈ Create/update tag
uses: actions/github-script@v7
if: "${{ inputs.release-new-build }}"
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/prerelease',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/prerelease',
sha: context.sha
});
})
- name: π° Build Changelog
uses: mikepenz/release-changelog-builder-action@v4
if: "${{ inputs.release-new-build }}"
with:
outputFile: CHANGELOG.md
fromTag: ${{ env.FROM_TAG }}
toTag: "prerelease"
configurationJson: |
{
"template": "## π° Development News\n- πΈ Support Loop by [sponsoring the project](https://github.com/sponsors/MrKai77)!\n- π Let us know if you are interested in localizing Loop to your language :)\n- π¬ Join our [Discord server](https://discord.gg/2CZ2N6PKjq)!\n#{{CHANGELOG}}\n## π Uncategorized\n#{{UNCATEGORIZED}}\n---\nMinimum macOS version: 13.0",
"pr_template": "- #{{TITLE}} ##{{NUMBER}}",
"categories": [
{
"title": "## β¨ New Features",
"labels": ["Feature", "Luminare", "Improvement"]
},
{
"title": "## π Bug Fixes",
"labels": ["Bug"]
},
{
"title": "## π Localization",
"labels": ["Localization"]
}
],
"empty_template": "- β No changes found"
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: π₯³ Publish Dev Build
uses: ncipollo/release-action@v1
if: "${{ inputs.release-new-build }}"
with:
allowUpdates: true
artifacts: dist/Loop.zip
commit: develop
bodyFile: CHANGELOG.md
name: "${{ env.APP_VERSION }} (${{ env.APP_BUILD }})"
prerelease: true
tag: "prerelease"
- name: π§Ή Cleanup
run: |
security delete-keychain "$RUNNER_TEMP/app-signing.keychain-db"