-
-
Notifications
You must be signed in to change notification settings - Fork 9
171 lines (146 loc) · 6.18 KB
/
main.yml
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
name: Build and Release App
on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- '**.github/workflows/*'
- '**examples/*'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
release:
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Xcode Select Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '16.1'
- name: Setup Certificate
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.P12_CERTIFICATE_BASE64 }}
p12-password: ${{ secrets.P12_PASSWORD }}
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
skipInvalidTags: true
noVersionBumpBehavior: "error"
majorList: "major, breaking"
patchAll: true
token: ${{ env.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version in Config.xcconfig
run: |
CURRENT_BUILD=$(grep BUILD_NUMBER ishare/Config.xcconfig | cut -d ' ' -f 3)
NEW_BUILD=$((CURRENT_BUILD + 1))
sed -i '' "s/BUILD_NUMBER = $CURRENT_BUILD/BUILD_NUMBER = $NEW_BUILD/" ishare/Config.xcconfig
CURRENT_VERSION=$(grep VERSION ishare/Config.xcconfig | cut -d ' ' -f 3)
NEW_VERSION=${{ steps.semver.outputs.nextStrict }}
sed -i '' "s/VERSION = $CURRENT_VERSION/VERSION = $NEW_VERSION/" ishare/Config.xcconfig
- name: Build Changelog
uses: dlavrenuek/[email protected]
id: changelog
with:
from: ${{ steps.semver.outputs.current }}
to: HEAD
- name: Build macOS app
run: xcodebuild archive -scheme "GitHub" -configuration "Release" -archivePath "build/ishare.xcarchive" -destination "generic/platform=macOS,name=Any Mac" CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO "OTHER_SWIFT_FLAGS=${inherited} -D GITHUB_RELEASE" | xcbeautify
- name: Sign, Package and Notarize .app
run: |
cp -R "build/ishare.xcarchive/Products/Applications/"*.app "build/ishare.app"
cd build
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader"
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer"
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/Updater.app/Contents/MacOS/Updater"
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/Frameworks/Sparkle.framework/Versions/B/Autoupdate"
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app/Contents/MacOS/ishare"
codesign -s "Developer ID Application" -f --timestamp -o runtime --deep "ishare.app"
npm install --global create-dmg
create-dmg "ishare.app" --overwrite
mv *.dmg ishare.dmg
DMG_FILE="ishare.dmg"
echo "DMG_FILE=$DMG_FILE" >> $GITHUB_ENV
xcrun notarytool submit "$DMG_FILE" --wait --apple-id "${{ secrets.NOTARIZATION_USERNAME }}" --password "${{ secrets.NOTARIZATION_PASSWORD }}" --team-id "L988J7YMK5"
xcrun stapler staple "$DMG_FILE"
- name: Configure Sparkle
run: |
curl -L -o Sparkle-2.4.2.tar.xz https://github.com/sparkle-project/Sparkle/releases/download/2.4.2/Sparkle-2.4.2.tar.xz
tar -xJf Sparkle-2.4.2.tar.xz
mkdir update
mv "./build/$DMG_FILE" update/
echo "${{ steps.changelog.outputs.body }}" > RELEASE.md
chmod +x ./bin/generate_appcast
- name: Convert Markdown to HTML
uses: jaywcjlove/markdown-to-html-cli@main
with:
source: RELEASE.md
output: ./update/${DMG_FILE%.dmg}.html
github-corners: false
- name: Generate appcast.xml
run: echo "$EDDSA_PRIVATE_KEY" | ./bin/generate_appcast --ed-key-file - --link https://isharemac.app --embed-release-notes --download-url-prefix https://github.com/castdrian/ishare/releases/latest/download/ update/
env:
EDDSA_PRIVATE_KEY: ${{ secrets.EDDSA_PRIVATE_KEY }}
ARCHIVES_SOURCE_DIR: .
- name: Archive appcast.xml as artifact
uses: actions/upload-artifact@v4
with:
name: appcast
path: ./update/appcast.xml
- name: Commit & Push changes
uses: EndBug/add-and-commit@v9
with:
add: 'ishare/Config.xcconfig'
default_author: github_actions
fetch: false
message: 'Bump version [skip ci]'
push: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.semver.outputs.next }}
body_path: RELEASE.md
files: ./update/*.dmg
fail_on_unmatched_files: true
token: ${{ env.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pages:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download appcast.xml artifact
uses: actions/download-artifact@v4
with:
name: appcast
path: ./
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2