Skip to content

Commit a2e2033

Browse files
committed
ci: run the private-drop squash workflow on push to the test branch
Dispatch by file name only resolves workflows on the default branch, so the test branch cannot trigger it; the job skips itself with a notice until the draft release exists. 中文:workflow_dispatch 按文件名只能解析默认分支上的 workflow,测试分支无法触发;改为在该分支 push 时运行,draft release 不存在时直接跳过并提示。
1 parent b2ce4ba commit a2e2033

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎.github/workflows/amd-exporter-privatedrop.yml‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ name: AMD exporter private drop
66
# AMD's private drop and must not leave the draft release.
77

88
on:
9+
# Dispatch by file name only resolves workflows on the default branch, so the test
10+
# branch runs this on push; the job skips itself until the draft release exists.
11+
push:
12+
branches: [feat/powerx-amd-highres-privatedrop]
913
workflow_dispatch:
1014
inputs:
1115
release-tag:
@@ -44,18 +48,25 @@ jobs:
4448
with:
4549
persist-credentials: false
4650
- name: Download the archive from the draft release
51+
id: download
4752
env:
4853
GITHUB_TOKEN: ${{ github.token }}
49-
RELEASE_TAG: ${{ inputs.release-tag }}
54+
RELEASE_TAG: ${{ inputs.release-tag || 'amd-dme-highres-privatedrop-20261008' }}
5055
run: |
5156
set -eo pipefail
5257
mkdir -p "$WORK"
58+
if ! python3 .github/scripts/draft_release_asset.py --tag "$RELEASE_TAG" --list; then
59+
echo "::notice::draft release $RELEASE_TAG does not exist yet; nothing to convert"
60+
echo "skip=true" >> "$GITHUB_OUTPUT"
61+
exit 0
62+
fi
5363
python3 .github/scripts/draft_release_asset.py --tag "$RELEASE_TAG" --find "$ARCHIVE_NAME" > "$WORK/archive-asset.json"
5464
asset_url=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["url"])' "$WORK/archive-asset.json")
5565
curl --fail --location --silent --show-error --output "$WORK/$ARCHIVE_NAME" \
5666
--header "Authorization: Bearer $GITHUB_TOKEN" --header "Accept: application/octet-stream" "$asset_url"
5767
printf '%s %s\n' "$ARCHIVE_SHA256" "$WORK/$ARCHIVE_NAME" | sha256sum --check -
5868
- name: Load the image and check its identity
69+
if: steps.download.outputs.skip != 'true'
5970
run: |
6071
set -eo pipefail
6172
docker load --input "$WORK/$ARCHIVE_NAME"
@@ -67,6 +78,7 @@ jobs:
6778
echo "version probe unavailable on CPU: $(tail -n 1 "$WORK/version.txt")"
6879
cat "$WORK/version.txt"
6980
- name: Convert to an Enroot squash
81+
if: steps.download.outputs.skip != 'true'
7082
run: |
7183
set -eo pipefail
7284
curl --fail --location --output "$WORK/$ENROOT_PACKAGE" \
@@ -99,9 +111,10 @@ jobs:
99111
sha256sum "$SQSH_NAME" provenance.json > SHA256SUMS
100112
cat SHA256SUMS
101113
- name: Store the squash on the draft release
114+
if: steps.download.outputs.skip != 'true'
102115
env:
103116
GITHUB_TOKEN: ${{ github.token }}
104-
RELEASE_TAG: ${{ inputs.release-tag }}
117+
RELEASE_TAG: ${{ inputs.release-tag || 'amd-dme-highres-privatedrop-20261008' }}
105118
run: |
106119
set -eo pipefail
107120
for name in "$SQSH_NAME" SHA256SUMS provenance.json; do

0 commit comments

Comments
 (0)