Skip to content

Commit 448a5fa

Browse files
authored
Update GitHub actions upload/download artifact (major) (#47415)
Also rename some of the artifacts to take advantage of the new single-file-upload ability.
1 parent f627d83 commit 448a5fa

7 files changed

Lines changed: 93 additions & 91 deletions

File tree

.github/workflows/build-docker-monorepo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ jobs:
135135
touch "$TEMP/digests/${DIGEST#sha256:}"
136136
137137
- name: Upload digest
138-
uses: actions/upload-artifact@v6
138+
uses: actions/upload-artifact@v7
139139
with:
140140
name: digests-linux-${{ matrix.platform }}
141141
path: ${{ runner.temp }}/digests/*
@@ -153,7 +153,7 @@ jobs:
153153

154154
steps:
155155
- name: Download digests
156-
uses: actions/download-artifact@v7
156+
uses: actions/download-artifact@v8
157157
with:
158158
path: ${{ runner.temp }}/digests
159159
pattern: digests-*

.github/workflows/build-docker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
touch "$TEMP/digests/${DIGEST#sha256:}"
137137
138138
- name: Upload digest
139-
uses: actions/upload-artifact@v6
139+
uses: actions/upload-artifact@v7
140140
with:
141141
name: digests-linux-${{ matrix.platform }}
142142
path: ${{ runner.temp }}/digests/*
@@ -154,7 +154,7 @@ jobs:
154154

155155
steps:
156156
- name: Download digests
157-
uses: actions/download-artifact@v7
157+
uses: actions/download-artifact@v8
158158
with:
159159
path: ${{ runner.temp }}/digests
160160
pattern: digests-*

.github/workflows/build.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -146,26 +146,39 @@ jobs:
146146
# This is the official workaround: https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files
147147
# It'll also make it faster to upload and download though, so maybe it's a win anyway.
148148
- name: Create archive
149-
run: tar --owner=0 --group=0 --xz -cvvf build.tar.xz -C "$BUILD_BASE" --transform 's,^\.,build,' .
149+
run: |
150+
tar --owner=0 --group=0 --xz -cvvf jetpack-build.tar.xz -C "$BUILD_BASE" --transform 's,^\.,build,' .
151+
# For Store build as artifact (old)
152+
ln jetpack-build.tar.xz build.tar.xz
150153
151-
- name: Store build as artifact
152-
uses: actions/upload-artifact@v6
154+
# 2026-03-02: Temporarily upload the artifact twice, under both old and new names, as we update things using the old name.
155+
- name: Store build as artifact (old)
156+
uses: actions/upload-artifact@v7
153157
with:
154158
name: jetpack-build
155159
path: build.tar.xz
156160
# Retain trunk builds for 7 days so we can manually download for branch comparisons. Branch builds only need one day so the beta builder can slurp it up to distribute.
157161
retention-days: ${{ case( github.ref == 'refs/heads/trunk', 7, 1 ) }}
158162
# Already compressed.
159163
compression-level: 0
164+
- name: Store build as artifact (new)
165+
uses: actions/upload-artifact@v7
166+
with:
167+
path: jetpack-build.tar.xz
168+
# Retain trunk builds for 7 days so we can manually download for branch comparisons. Branch builds only need one day so the beta builder can slurp it up to distribute.
169+
retention-days: ${{ case( github.ref == 'refs/heads/trunk', 7, 1 ) }}
170+
# Already compressed.
171+
compression-level: 0
172+
archive: false
160173

161174
- name: Store plugins.tsv as artifact
162175
if: steps.plugins.outputs.any == 'true'
163-
uses: actions/upload-artifact@v6
176+
uses: actions/upload-artifact@v7
164177
with:
165-
name: plugins.tsv
166178
path: ${{ env.BUILD_BASE }}/plugins.tsv
167179
# We don't really care about this artifact, its presence is a flag to the post-build job.
168180
retention-days: 1
181+
archive: false
169182

170183
- name: Update reminder with testing instructions
171184
id: update-reminder-comment
@@ -191,11 +204,11 @@ jobs:
191204
path: monorepo
192205

193206
- name: Download build artifact
194-
uses: actions/download-artifact@v7
207+
uses: actions/download-artifact@v8
195208
with:
196-
name: jetpack-build
209+
name: jetpack-build.tar.xz
197210
- name: Extract build archive
198-
run: tar --xz -xvvf build.tar.xz build
211+
run: tar --xz -xvvf jetpack-build.tar.xz build
199212

200213
- name: Prepare plugin zips
201214
id: prepare
@@ -257,7 +270,7 @@ jobs:
257270
echo "any-built=$ANY_BUILT" >> "$GITHUB_OUTPUT"
258271
259272
- name: Create plugins artifact
260-
uses: actions/upload-artifact@v6
273+
uses: actions/upload-artifact@v7
261274
if: steps.prepare.outputs.any-built == 'true'
262275
with:
263276
name: plugins
@@ -288,12 +301,12 @@ jobs:
288301
timeout-minutes: 1 # 2025-11-06: Successful runs seem to take a few seconds
289302

290303
- name: Download build artifact
291-
uses: actions/download-artifact@v7
304+
uses: actions/download-artifact@v8
292305
with:
293-
name: jetpack-build
306+
name: jetpack-build.tar.xz
294307
timeout-minutes: 2 # 2025-11-06: Successful runs normally take a few seconds
295308
- name: Extract build archive
296-
run: tar --xz -xvvf build.tar.xz build
309+
run: tar --xz -xvvf jetpack-build.tar.xz build
297310
timeout-minutes: 1 # 2025-11-06: Successful runs seem to take a few seconds
298311

299312
- name: Wait for prior instances of the workflow to finish

.github/workflows/e2e-tests.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ jobs:
9696
COMPOSER_ROOT_VERSION: "dev-trunk"
9797
BUILD_DIR: ./build-output
9898
PROJECT_PATH: ${{ matrix.path }}
99+
BUILD_GROUP: ${{ matrix.buildGroup }}
99100
run: |
100101
find . -path ./.github -prune -o -type f -print | sort > /tmp/before.txt
101102
find . -path ./.github -prune -o -type l -print | sort > /tmp/beforel.txt
@@ -130,17 +131,17 @@ jobs:
130131
echo "::endgroup::"
131132
132133
echo "::group::Creating artifact"
133-
sed 's!^!./!' /tmp/changed.txt /tmp/changedl.txt | tar -cvvf build-cache.tar.xz --verbatim-files-from --files-from=-
134+
sed 's!^!./!' /tmp/changed.txt /tmp/changedl.txt | tar -cvvf "$BUILD_GROUP.tar.xz" --verbatim-files-from --files-from=-
134135
echo "::endgroup::"
135136
136137
- name: Save ${{ matrix.buildGroup }} build cache
137-
uses: actions/upload-artifact@v6
138+
uses: actions/upload-artifact@v7
138139
with:
139-
name: ${{ matrix.buildGroup }}
140-
path: build-cache.tar.xz
140+
path: ${{ matrix.buildGroup }}.tar.xz
141141
retention-days: 1
142142
# Already compressed.
143143
compression-level: 0
144+
archive: false
144145

145146
e2e-tests:
146147
name: "${{ matrix.project }} e2e tests"
@@ -162,14 +163,16 @@ jobs:
162163
- uses: actions/checkout@v6
163164

164165
- name: Restore ${{ matrix.buildGroup }} build cache
165-
uses: actions/download-artifact@v7
166+
uses: actions/download-artifact@v8
166167
if: needs.build-projects.result == 'success' && ! startsWith( matrix.suite, 'atomic' )
167168
with:
168-
name: ${{ matrix.buildGroup }}
169+
name: ${{ matrix.buildGroup }}.tar.xz
169170
- name: Extract ${{ matrix.buildGroup }} build cache
170171
if: needs.build-projects.result == 'success' && ! startsWith( matrix.suite, 'atomic' )
172+
env:
173+
BUILD_GROUP: ${{ matrix.buildGroup }}
171174
run: |
172-
tar -xvvf build-cache.tar.xz .
175+
tar -xvvf "$BUILD_GROUP.tar.xz" .
173176
174177
- name: Setup tools
175178
uses: ./.github/actions/tool-setup
@@ -314,7 +317,7 @@ jobs:
314317
- name: Upload test artifacts
315318
if: ${{ always() }}
316319
continue-on-error: true
317-
uses: actions/upload-artifact@v6
320+
uses: actions/upload-artifact@v7
318321
with:
319322
name: test-output-${{ matrix.project }}
320323
path: ${{ matrix.path }}/output
@@ -398,7 +401,7 @@ jobs:
398401
working-directory: ./projects/github-actions/test-results-to-slack
399402

400403
- name: Download test artifacts
401-
uses: actions/download-artifact@v7
404+
uses: actions/download-artifact@v8
402405
with:
403406
path: test-output
404407

.github/workflows/post-build.yml

Lines changed: 46 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ jobs:
125125
if: github.event.workflow_run.conclusion == 'success'
126126
timeout-minutes: 2 # 2025-11-20: Takes a few seconds.
127127
outputs:
128-
zip_url: ${{ steps.run.outputs.zip_url }}
128+
artifact_name: ${{ steps.run.outputs.artifact_name }}
129+
artifact_filename: ${{ steps.run.outputs.artifact_filename }}
129130
any_plugins: ${{ steps.run.outputs.any_plugins }}
130131
steps:
131132
- uses: actions/checkout@v6
@@ -136,6 +137,8 @@ jobs:
136137
TOKEN: ${{ github.token }}
137138
URL: ${{ github.event.workflow_run.artifacts_url }}
138139
run: |
140+
ARTIFACT_NAME=
141+
ARTIFACT_FILENAME=
139142
for (( i=1; i<=5; i++ )); do
140143
[[ $i -gt 1 ]] && sleep 10
141144
echo "::group::Fetch list of artifacts (attempt $i/5)"
@@ -145,15 +148,25 @@ jobs:
145148
)"
146149
echo "$JSON"
147150
echo "::endgroup::"
148-
ZIPURL="$(jq -r '.artifacts | map( select( .name == "jetpack-build" ) ) | sort_by( .created_at ) | last | .archive_download_url // empty' <<<"$JSON")"
151+
149152
PLUGINS="$(jq -r '.artifacts[] | select( .name == "plugins.tsv" )' <<<"$JSON")"
150-
if [[ -n "$ZIPURL" ]]; then
153+
154+
# 2026-03-02: Temporarily look for both old and new artifacts.
155+
if jq -e '.artifacts | map( select( .name == "jetpack-build.tar.xz" ) )' <<<"$JSON" &>/dev/null; then
156+
ARTIFACT_NAME=jetpack-build.tar.xz
157+
ARTIFACT_FILENAME=jetpack-build.tar.xz
158+
break
159+
fi
160+
if jq -e '.artifacts | map( select( .name == "jetpack-build" ) )' <<<"$JSON" &>/dev/null; then
161+
ARTIFACT_NAME=jetpack-build
162+
ARTIFACT_FILENAME=build.tar.xz
151163
break
152164
fi
153165
done
154-
[[ -z "$ZIPURL" ]] && { echo "::error::Failed to find artifact."; exit 1; }
155-
echo "Zip URL: $ZIPURL"
156-
echo "zip_url=${ZIPURL}" >> "$GITHUB_OUTPUT"
166+
[[ -z "$ARTIFACT_NAME" ]] && { echo "::error::Failed to find artifact."; exit 1; }
167+
echo "Artifact name: $ARTIFACT_NAME"
168+
echo "artifact_name=${ARTIFACT_NAME}" >> "$GITHUB_OUTPUT"
169+
echo "artifact_filename=${ARTIFACT_FILENAME}" >> "$GITHUB_OUTPUT"
157170
if [[ -z "$PLUGINS" ]]; then
158171
echo "Any plugins? No"
159172
echo "any_plugins=false" >> "$GITHUB_OUTPUT"
@@ -269,26 +282,17 @@ jobs:
269282
token: ${{ steps.get_token.outputs.token }}
270283

271284
- name: Download build artifact
285+
uses: actions/download-artifact@v8
286+
with:
287+
name: ${{ needs.find_artifact.outputs.artifact_name }}
288+
github-token: ${{ github.token }}
289+
run-id: ${{ github.event.workflow_run.id }}
290+
291+
- name: Extract build artifact
272292
env:
273-
TOKEN: ${{ github.token }}
274-
ZIPURL: ${{ needs.find_artifact.outputs.zip_url }}
293+
ARTIFACT_FILENAME: ${{ needs.find_artifact.outputs.artifact_filename }}
275294
shell: bash
276-
run: |
277-
for (( i=1; i<=2; i++ )); do
278-
[[ $i -gt 1 ]] && sleep 10
279-
echo "::group::Downloading artifact (attempt $i/2)"
280-
curl -v -L --get \
281-
--header "Authorization: token $TOKEN" \
282-
--url "$ZIPURL" \
283-
--output "artifact.zip"
284-
echo "::endgroup::"
285-
if [[ -e "artifact.zip" ]] && zipinfo artifact.zip &>/dev/null; then
286-
break
287-
fi
288-
done
289-
[[ ! -e "artifact.zip" ]] && { echo "::error::Failed to download artifact."; exit 1; }
290-
unzip artifact.zip
291-
tar --xz -xvvf build.tar.xz build/plugins.tsv
295+
run: tar --xz -xvvf "$ARTIFACT_FILENAME" build/plugins.tsv
292296

293297
- name: Prepare matrix
294298
id: matrix
@@ -345,26 +349,17 @@ jobs:
345349
path: commit
346350

347351
- name: Download build artifact
352+
uses: actions/download-artifact@v8
353+
with:
354+
name: ${{ needs.find_artifact.outputs.artifact_name }}
355+
github-token: ${{ github.token }}
356+
run-id: ${{ github.event.workflow_run.id }}
357+
358+
- name: Extract build artifact
348359
env:
349-
TOKEN: ${{ github.token }}
350-
ZIPURL: ${{ needs.find_artifact.outputs.zip_url }}
360+
ARTIFACT_FILENAME: ${{ needs.find_artifact.outputs.artifact_filename }}
351361
shell: bash
352-
run: |
353-
for (( i=1; i<=2; i++ )); do
354-
[[ $i -gt 1 ]] && sleep 10
355-
echo "::group::Downloading artifact (attempt $i/2)"
356-
curl -v -L --get \
357-
--header "Authorization: token $TOKEN" \
358-
--url "$ZIPURL" \
359-
--output "artifact.zip"
360-
echo "::endgroup::"
361-
if [[ -e "artifact.zip" ]] && zipinfo artifact.zip &>/dev/null; then
362-
break
363-
fi
364-
done
365-
[[ ! -e "artifact.zip" ]] && { echo "::error::Failed to download artifact."; exit 1; }
366-
unzip artifact.zip
367-
tar --xz -xvvf build.tar.xz build
362+
run: tar --xz -xvvf "$ARTIFACT_FILENAME" build
368363

369364
- name: Setup WordPress
370365
run: trunk/.github/files/test-plugin-update/setup.sh
@@ -442,26 +437,17 @@ jobs:
442437
token: ${{ steps.get_token.outputs.token }}
443438

444439
- name: Download build artifact
440+
uses: actions/download-artifact@v8
441+
with:
442+
name: ${{ needs.find_artifact.outputs.artifact_name }}
443+
github-token: ${{ github.token }}
444+
run-id: ${{ github.event.workflow_run.id }}
445+
446+
- name: Extract build artifact
445447
env:
446-
TOKEN: ${{ github.token }}
447-
ZIPURL: ${{ needs.find_artifact.outputs.zip_url }}
448+
ARTIFACT_FILENAME: ${{ needs.find_artifact.outputs.artifact_filename }}
448449
shell: bash
449-
run: |
450-
for (( i=1; i<=2; i++ )); do
451-
[[ $i -gt 1 ]] && sleep 10
452-
echo "::group::Downloading artifact (attempt $i/2)"
453-
curl -v -L --get \
454-
--header "Authorization: token $TOKEN" \
455-
--url "$ZIPURL" \
456-
--output "artifact.zip"
457-
echo "::endgroup::"
458-
if [[ -e "artifact.zip" ]] && zipinfo artifact.zip &>/dev/null; then
459-
break
460-
fi
461-
done
462-
[[ ! -e "artifact.zip" ]] && { echo "::error::Failed to download artifact."; exit 1; }
463-
unzip artifact.zip
464-
tar --xz -xvvf build.tar.xz build
450+
run: tar --xz -xvvf "$ARTIFACT_FILENAME" build
465451

466452
- name: Test filename restrictions
467453
id: tests

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ jobs:
315315
- name: Upload artifacts
316316
id: upload-artifacts
317317
if: always() && steps.check-artifacts.outputs.any == 'true'
318-
uses: actions/upload-artifact@v6
318+
uses: actions/upload-artifact@v7
319319
with:
320320
name: ${{ matrix.artifact }}
321321
path: artifacts
@@ -343,7 +343,7 @@ jobs:
343343
uses: ./.github/actions/tool-setup
344344

345345
- name: Download coverage artifact
346-
uses: actions/download-artifact@v7
346+
uses: actions/download-artifact@v8
347347
with:
348348
name: 'Code coverage'
349349
path: coverage

.github/workflows/wpcloud.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ jobs:
6666
echo "::endgroup::"
6767
6868
- name: Store artifact
69-
uses: actions/upload-artifact@v6
69+
uses: actions/upload-artifact@v7
7070
with:
71-
name: wpcomsh
7271
path: wpcomsh.tar.xz
7372
retention-days: 1
7473
# Already compressed.
7574
compression-level: 0
75+
archive: false
7676

7777
deploy:
7878
name: Run PHPUnit on the WP Cloud test site
@@ -81,9 +81,9 @@ jobs:
8181
if: needs.build.outputs.wpcomsh == 'true'
8282
steps:
8383
- name: Download build artifact
84-
uses: actions/download-artifact@v7
84+
uses: actions/download-artifact@v8
8585
with:
86-
name: wpcomsh
86+
name: wpcomsh.tar.xz
8787

8888
- name: Configure Github to be able to SSH to the WP Cloud site
8989
run: |

0 commit comments

Comments
 (0)