-
-
Notifications
You must be signed in to change notification settings - Fork 9
163 lines (136 loc) · 4.86 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
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-13
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Certificate
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
p12-password: ${{ secrets.P12_PASSWORD }}
- name: Xcode Select Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
skipInvalidTags: true
noVersionBumpBehavior: "error"
majorList: "major, breaking"
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 "ishare" -configuration "Release" -archivePath "build/ishare.xcarchive" -destination "platform=macOS"
- 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: Export .app from .xcarchive
run: cp -R "build/ishare.xcarchive/Products/Applications/ishare.app" "build/"
- name: Archive .app
run: cd build && zip -r "ishare_macOS.zip" "ishare.app"
- name: Download 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
- name: Extract Sparkle
run: tar -xJf Sparkle-2.4.2.tar.xz
- name: Prepare update folder
run: |
mkdir update
mv ./build/ishare_macOS.zip update/
echo "${{ steps.changelog.outputs.body }}" > RELEASE.md
- name: Convert Markdown to HTML
uses: jaywcjlove/markdown-to-html-cli@main
with:
source: RELEASE.md
output: ./update/ishare_macOS.html
github-corners: false
- name: Set executable bit for generate_appcast
run: chmod +x ./bin/generate_appcast
- 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: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.semver.outputs.next }}
body_path: RELEASE.md
files: ./update/ishare_macOS.zip
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@v3
- 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