forked from recyclarr/recyclarr
-
Notifications
You must be signed in to change notification settings - Fork 0
229 lines (206 loc) · 6.39 KB
/
build.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
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build & Test
on:
push:
pull_request:
jobs:
#############################################
build-win:
name: Build Windows
secrets: inherit
uses: ./.github/workflows/reusable-build.yml
strategy:
matrix:
runtime: [win-x64, win-arm64]
with:
platform: windows-latest
runtime: ${{ matrix.runtime }}
#############################################
build-linux:
name: Build Linux
secrets: inherit
uses: ./.github/workflows/reusable-build.yml
strategy:
matrix:
runtime: [linux-x64, linux-arm64, linux-arm]
with:
platform: ubuntu-latest
runtime: ${{ matrix.runtime }}
#############################################
build-osx:
name: Build Mac OS
secrets: inherit
uses: ./.github/workflows/reusable-build.yml
strategy:
matrix:
runtime: [osx-x64, osx-arm64]
with:
platform: macos-latest
runtime: ${{ matrix.runtime }}
#############################################
# Note: This builds the MUSL zip artifacts but isn't used in the actual docker image build
build-musl:
name: Build MUSL
secrets: inherit
uses: ./.github/workflows/reusable-build.yml
strategy:
matrix:
runtime: [linux-musl-x64, linux-musl-arm, linux-musl-arm64]
with:
platform: ubuntu-latest
runtime: ${{ matrix.runtime }}
publish-args: -NoSingleFile
skip-test: true
#############################################
codesign:
name: Apple Signing
runs-on: macos-latest
# non-master branches
if: |
github.event_name == 'pull_request' ||
github.ref == 'refs/heads/master' ||
startsWith(github.ref, 'refs/tags/v')
needs: [build-osx]
strategy:
matrix:
runtime:
- osx-x64
- osx-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: ./.github/actions/download-tar
with:
name: ${{ matrix.runtime }}
path: publish
- name: Add Cert to Keychain
# todo: Switch back to upstream when this is merged:
# https://github.com/Apple-Actions/import-codesign-certs/pull/58
uses: recyclarr/import-codesign-certs@master
with:
p12-file-base64: ${{ secrets.MAC_CERT_BASE64 }}
p12-password: ${{ secrets.MAC_CERT_PASSWORD }}
- name: Code Sign
env:
CODESIGN_IDENTITY: ${{ secrets.MAC_CODESIGN_IDENTITY }}
run: >
codesign --timestamp --no-strict --force
--options=runtime
--entitlements ci/codesign/entitlements.plist
--sign "$CODESIGN_IDENTITY"
"publish/recyclarr"
- name: Notarize
run: >-
ci/notarize.sh
"${{ secrets.MAC_DEV_USERNAME }}"
"${{ secrets.MAC_DEV_PASSWORD }}"
AVLRN599D8
publish/recyclarr
# Cannot staple directly to a binary:
# https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?language=objc#3087720
# - name: Staple
# run: xcrun stapler staple -v publish/recyclarr
- name: Upload Artifacts
uses: ./.github/actions/upload-tar
with:
name: ${{ matrix.runtime }}
path: publish
#############################################
docker:
name: Docker
# Wait on builds only to verify tests pass
needs: [build-win, build-linux, build-osx, build-musl]
uses: ./.github/workflows/reusable-docker.yml
secrets: inherit
#############################################
test-artifact-download:
name: Test Artifact Download
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/v')"
needs:
- build-win
- build-linux
- codesign # Depends on build-osx
- docker # Depends on build-musl
env:
XZ_OPT: "-T0 -9"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Artifacts
uses: ./.github/actions/download-tar
with:
path: publish
#############################################
release:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build-win
- build-linux
- build-musl
- codesign # Depends on build-osx, and reuploads artifacts after signing
env:
XZ_OPT: "-T0 -9"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: 6.0.x
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0
id: gitversion
- name: Download Artifacts
uses: ./.github/actions/download-tar
with:
path: publish
- name: Create Archive
shell: pwsh
run: >
ci/CreateArchive.ps1
-PublishDir publish
-OutputDir archive
- name: Extract Changelog
id: changelog
uses: ffurrer2/extract-release-notes@v2
- name: Create Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_PAT }}
with:
files: |
archive/**/recyclarr-*.zip
archive/**/recyclarr-*.tar.xz
body: ${{ steps.changelog.outputs.release_notes }}
tag_name: ${{ github.event.create.ref }}
draft: false
prerelease: ${{ steps.gitversion.outputs.preReleaseTag != '' }}
#############################################
# The main purpose of this job is to group all the other jobs together into one single job status
# that can be set as a requirement to merge pull requests. This is easier than enumerating all
# jobs in a workflow to ensure they all pass.
check:
if: always()
name: Report Build Status
needs:
- build-win
- build-linux
- build-osx
- build-musl
- codesign
- docker
- release
- test-artifact-download
runs-on: ubuntu-latest
steps:
- name: Check if all jobs succeeded
uses: re-actors/alls-green@release/v1
with:
allowed-skips: codesign, release, test-artifact-download
jobs: ${{ toJSON(needs) }}