Repository navigation
221 lines (190 loc) · 7.05 KB
/
Copy pathbuild.yml
File metadata and controls
221 lines (190 loc) · 7.05 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
name: Build and test
concurrency:
group: w64devkit-${{ github.ref }}
cancel-in-progress: true
on:
push:
pull_request:
branches: [ "master" ]
# Must set Settings -> Actions -> General -> Workflow permissions to
# "Read and write permissions"
permissions:
contents: write
id-token: write
jobs:
build-x64:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
env:
ARCH: x64
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Generate archive name and version string
id: filename
run: |
GIT_VERSION="$(git describe --tags --always)"
VERSION="${GIT_VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "archive=w64devkit-$ARCH-$VERSION" >> $GITHUB_OUTPUT
- name: Build image
uses: docker/build-push-action@v7
with:
context: .
build-args: VARIANT=x64
tags: w64devkit:${{ env.ARCH }}
load: true
cache-from: type=gha,scope=w64devkit-${{ env.ARCH }}
cache-to: type=gha,scope=w64devkit-${{ env.ARCH }},mode=max,ignore-error=true
- name: Build source image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v7
with:
context: .
target: source
tags: w64devkit:source
load: true
cache-from: type=gha,scope=w64devkit-${{ env.ARCH }}
- name: Extract artifact
run: |
docker run --rm w64devkit:${{ env.ARCH }} > w64devkit.exe
mv w64devkit.exe ${{ steps.filename.outputs.archive }}.7z.exe
ls -lh ${{ steps.filename.outputs.archive }}.7z.exe
- name: Extract source tarball
if: startsWith(github.ref, 'refs/tags/')
run: |
docker run --rm w64devkit:source tar cf - \
--sort=name --mtime='1970-01-01' --owner=0 --group=0 --numeric-owner \
source/ > source.tar
ls -lh source.tar
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ steps.filename.outputs.archive }}.7z.exe
path: ${{ steps.filename.outputs.archive }}.7z.exe
archive: false
- name: Upload source tarball
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v7
with:
name: source.tar
path: source.tar
archive: false
build-x86:
runs-on: ubuntu-latest
needs: build-x64
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
env:
ARCH: x86
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Generate archive name and version string
id: filename
run: |
GIT_VERSION="$(git describe --tags --always)"
VERSION="${GIT_VERSION#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "archive=w64devkit-$ARCH-$VERSION" >> $GITHUB_OUTPUT
- name: Build image
uses: docker/build-push-action@v7
with:
context: .
build-args: VARIANT=x86
tags: w64devkit:${{ env.ARCH }}
load: true
cache-from: type=gha,scope=w64devkit-${{ env.ARCH }}
cache-to: type=gha,scope=w64devkit-${{ env.ARCH }},mode=max,ignore-error=true
- name: Extract artifact
run: |
docker run --rm w64devkit:${{ env.ARCH }} > w64devkit.exe
mv w64devkit.exe ${{ steps.filename.outputs.archive }}.7z.exe
ls -lh ${{ steps.filename.outputs.archive }}.7z.exe
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ${{ steps.filename.outputs.archive }}.7z.exe
path: ${{ steps.filename.outputs.archive }}.7z.exe
archive: false
release:
needs: [build-x64, build-x86]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: release
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AAS_SIGN_ENDPOINT: ${{ secrets.TRUSTED_SIGNING_ENDPOINT }}
AAS_SIGN_ACCOUNT: ${{ secrets.TRUSTED_SIGNING_ACCOUNT }}
AAS_SIGN_PROFILE: ${{ secrets.CERTIFICATE_PROFILE }}
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Compute version
id: filename
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build signed image (x64)
uses: docker/build-push-action@v7
with:
context: .
build-args: VARIANT=x64
target: signed
tags: w64devkit:x64-signed
load: true
cache-from: type=gha,scope=w64devkit-x64
cache-to: type=gha,scope=w64devkit-x64,mode=max,ignore-error=true
- name: Sign and pack (x64)
run: |
docker run --rm \
-e AZURE_CLIENT_ID -e AZURE_TENANT_ID \
-e AAS_SIGN_ENDPOINT -e AAS_SIGN_ACCOUNT -e AAS_SIGN_PROFILE \
-e ACTIONS_ID_TOKEN_REQUEST_URL -e ACTIONS_ID_TOKEN_REQUEST_TOKEN \
w64devkit:x64-signed \
> w64devkit-x64-${{ steps.filename.outputs.version }}.7z.exe
ls -lh w64devkit-x64-${{ steps.filename.outputs.version }}.7z.exe
- name: Build signed image (x86)
uses: docker/build-push-action@v7
with:
context: .
build-args: VARIANT=x86
target: signed
tags: w64devkit:x86-signed
load: true
cache-from: type=gha,scope=w64devkit-x86
cache-to: type=gha,scope=w64devkit-x86,mode=max,ignore-error=true
- name: Sign and pack (x86)
run: |
docker run --rm \
-e AZURE_CLIENT_ID -e AZURE_TENANT_ID \
-e AAS_SIGN_ENDPOINT -e AAS_SIGN_ACCOUNT -e AAS_SIGN_PROFILE \
-e ACTIONS_ID_TOKEN_REQUEST_URL -e ACTIONS_ID_TOKEN_REQUEST_TOKEN \
w64devkit:x86-signed \
> w64devkit-x86-${{ steps.filename.outputs.version }}.7z.exe
ls -lh w64devkit-x86-${{ steps.filename.outputs.version }}.7z.exe
- name: Download source tarball
uses: actions/download-artifact@v8
with:
name: source.tar
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=${{ steps.filename.outputs.version }}
# Tags like vX.Y.Z-rcN are pipeline-test runs: publish as a
# draft prerelease so they don't trigger release immutability
# and can be deleted/retried freely.
FLAGS=()
if [[ "$VERSION" == *-rc* ]]; then
FLAGS+=(--draft --prerelease)
fi
gh release create "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--title "$VERSION" \
"${FLAGS[@]}" \
w64devkit-*.7z.exe \
source.tar