Skip to content

Commit a6ccdd0

Browse files
committed
git-artifacts: allow restricting which artifacts are built
Users can now specify which artifacts they want to build, via passing a client payload that sets the `build_only` attribute, like this: curl -i -H 'Authorization: token <PAT>' \ -H 'Accept: application/vnd.github.everest-preview+json' \ --request POST \ --data '{ "event_type": "git-artifacts", "client_payload": { "build_only": "portable-x86_64" } }' https://api.github.com/repos/<user>/git/dispatches The `build_only` value is a comma-separated list of prefixes. Therefore, `installer,portable` will build `installer-x86_64`, `installer-i686`, `portable-x86_64` and `portable-i686`, and an empty or unset value will build all. Please note that the `mingw-w64-git` packages are built always, as it would be tricky to figure out when they need to be built (for example, `build_only=portable-x86_64` technically does not need `pkg-i686` to be built, while `build_only=portable` does). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 79d9e68 commit a6ccdd0

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

.github/workflows/git-artifacts.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
MSYSTEM: MINGW64
1313
PACKAGER: ${{github.actor}} <${{github.actor}}@users.noreply.github.com>
1414
USERPROFILE: "${{github.workspace}}\\home"
15+
BUILD_ONLY: "${{github.event.client_payload.build_only}}"
1516

1617
jobs:
1718
bundle-artifacts:
@@ -182,33 +183,44 @@ jobs:
182183
env:
183184
MSYSTEM: MINGW${{matrix.arch.bitness}}
184185
steps:
186+
- name: Determine whether this job should be skipped
187+
shell: python
188+
run: |
189+
import os
190+
if ("BUILD_ONLY" in os.environ) and len([x for x in os.environ["BUILD_ONLY"].split(",") if "${{matrix.artifact.name}}-${{matrix.arch.name}}".startswith(x)]) == 0:
191+
print("::set-env name=SKIP::true")
185192
- name: Download pkg-${{matrix.arch.name}}
193+
if: env.SKIP != 'true'
186194
uses: actions/download-artifact@v1
187195
with:
188196
name: pkg-${{matrix.arch.name}}
189197
path: pkg-${{matrix.arch.name}}
190198
- name: Download bundle-artifacts
199+
if: env.SKIP != 'true'
191200
uses: actions/download-artifact@v1
192201
with:
193202
name: bundle-artifacts
194203
path: bundle-artifacts
195204
- name: Download git-sdk-${{matrix.arch.bitness}}-build-installers
205+
if: env.SKIP != 'true'
196206
shell: bash
197207
run: a=git-sdk-${{matrix.arch.bitness}}-build-installers && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
198208
- name: Clone build-extra
209+
if: env.SKIP != 'true'
199210
run: git clone --single-branch -b master https://github.com/git-for-windows/build-extra git-sdk-${{matrix.arch.bitness}}-build-installers\usr\src\build-extra
200211
- name: Prepare home directory for code-signing
201212
env:
202213
CODESIGN_P12: ${{secrets.CODESIGN_P12}}
203214
CODESIGN_PASS: ${{secrets.CODESIGN_PASS}}
204-
if: (matrix.artifact.name == 'installer' || matrix.artifact.name == 'portable') && env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
215+
if: env.SKIP != 'true' && (matrix.artifact.name == 'installer' || matrix.artifact.name == 'portable') && env.CODESIGN_P12 != '' && env.CODESIGN_PASS != ''
205216
shell: bash
206217
run: |
207218
mkdir -p home/.sig &&
208219
echo "$CODESIGN_P12" | tr % '\n' | base64 -d >home/.sig/codesign.p12 &&
209220
echo "$CODESIGN_PASS" >home/.sig/codesign.pass &&
210221
git config --global alias.signtool '!sh "/usr/src/build-extra/signtool.sh"'
211222
- name: Build ${{matrix.arch.bitness}}-bit ${{matrix.artifact.name}}
223+
if: env.SKIP != 'true'
212224
shell: powershell
213225
run: |
214226
& .\git-sdk-${{matrix.arch.bitness}}-build-installers\usr\bin\bash.exe -lc @"
@@ -221,7 +233,7 @@ jobs:
221233
openssl dgst -sha256 artifacts/${{matrix.artifact.fileprefix}}-*.${{matrix.artifact.fileextension}} | sed \"s/.* //\" >artifacts/sha-256.txt
222234
"@
223235
- name: Copy package-versions and pdbs
224-
if: matrix.artifact.name == 'installer'
236+
if: env.SKIP != 'true' && matrix.artifact.name == 'installer'
225237
shell: powershell
226238
run: |
227239
& .\git-sdk-${{matrix.arch.bitness}}-build-installers\usr\bin\bash.exe -lc @"
@@ -235,10 +247,11 @@ jobs:
235247
GIT_CONFIG_PARAMETERS=\"'windows.sdk${{matrix.arch.bitness}}.path='\" ./please.sh bundle_pdbs --arch=${{matrix.arch.name}} --directory=\"`$a\" installer/package-versions.txt)
236248
"@
237249
- name: Clean up temporary files
238-
if: always()
250+
if: always() && env.SKIP != 'true'
239251
shell: bash
240252
run: rm -rf home
241253
- name: Publish ${{matrix.artifact.name}}-${{matrix.arch.name}}
254+
if: env.SKIP != 'true'
242255
uses: actions/upload-artifact@v1
243256
with:
244257
name: ${{matrix.artifact.name}}-${{matrix.arch.name}}
@@ -247,23 +260,35 @@ jobs:
247260
runs-on: windows-latest
248261
needs: pkg
249262
steps:
263+
- name: Determine whether this job should be skipped
264+
shell: python
265+
run: |
266+
import os
267+
if ("BUILD_ONLY" in os.environ) and len([x for x in os.environ["BUILD_ONLY"].split(",") if "nuget-x86_64".startswith(x)]) == 0:
268+
print("::set-env name=SKIP::true")
250269
- name: Download pkg-x86_64
270+
if: env.SKIP != 'true'
251271
uses: actions/download-artifact@v1
252272
with:
253273
name: pkg-x86_64
254274
path: pkg-x86_64
255275
- name: Download bundle-artifacts
276+
if: env.SKIP != 'true'
256277
uses: actions/download-artifact@v1
257278
with:
258279
name: bundle-artifacts
259280
path: bundle-artifacts
260281
- name: Download git-sdk-64-build-installers
282+
if: env.SKIP != 'true'
261283
shell: bash
262284
run: a=git-sdk-64-build-installers && mkdir -p $a && curl -# https://wingit.blob.core.windows.net/ci-artifacts/$a.tar.xz | tar -C $a -xJf -
263285
- name: Clone build-extra
286+
if: env.SKIP != 'true'
264287
run: git clone --single-branch -b master https://github.com/git-for-windows/build-extra git-sdk-64-build-installers\usr\src\build-extra
265288
- uses: nuget/setup-nuget@v1
289+
if: env.SKIP != 'true'
266290
- name: Build 64-bit NuGet packages
291+
if: env.SKIP != 'true'
267292
shell: powershell
268293
run: |
269294
& .\git-sdk-64-build-installers\usr\bin\bash.exe -lc @"
@@ -275,6 +300,7 @@ jobs:
275300
openssl dgst -sha256 artifacts/Git*.nupkg | sed \"s/.* //\" >artifacts/sha-256.txt
276301
"@
277302
- name: Publish nuget-x86_64
303+
if: env.SKIP != 'true'
278304
uses: actions/upload-artifact@v1
279305
with:
280306
name: nuget-x86_64

0 commit comments

Comments
 (0)