2020permissions :
2121 contents : write
2222
23- env :
24- NIGHTLY_TAG : nightly
25-
2623jobs :
2724 resolve-release-context :
2825 name : Resolve Release Context
2926 runs-on : ubuntu-24.04
3027 outputs :
3128 checkout_ref : ${{ steps.checkout-ref.outputs.ref }}
3229 tag : ${{ steps.tag.outputs.tag }}
30+ nightly_tag : ${{ steps.nightly-tag.outputs.nightly_tag }}
3331 steps :
32+ - name : Checkout repository for constants
33+ uses : actions/checkout@v6
34+ with :
35+ fetch-depth : 1
36+
37+ - name : Resolve nightly tag
38+ id : nightly-tag
39+ shell : bash
40+ run : |
41+ nightly_tag="$(python3 -c 'from astrbot.core.release_constants import NIGHTLY_TAG; print(NIGHTLY_TAG)')"
42+ if [ -z "$nightly_tag" ]; then
43+ echo "Failed to resolve NIGHTLY_TAG from astrbot.core.release_constants." >&2
44+ exit 1
45+ fi
46+ echo "nightly_tag=$nightly_tag" >> "$GITHUB_OUTPUT"
47+
3448 - name : Resolve checkout ref
3549 id : checkout-ref
3650 shell : bash
3751 run : |
3852 event_name="${{ github.event_name }}"
53+ nightly_tag="${{ steps.nightly-tag.outputs.nightly_tag }}"
3954 input_tag=""
4055 input_ref=""
4156 if [ "$event_name" = "workflow_dispatch" ]; then
4762 default_branch="master"
4863 fi
4964
50- if [ "$event_name" = "schedule" ] || { [ "$event_name" = "workflow_dispatch" ] && [ "$input_tag" = "$NIGHTLY_TAG " ]; }; then
65+ if [ "$event_name" = "schedule" ] || { [ "$event_name" = "workflow_dispatch" ] && [ "$input_tag" = "$nightly_tag " ]; }; then
5166 ref="refs/heads/${default_branch}"
5267 elif [ -n "$input_ref" ]; then
5368 ref="$input_ref"
5772
5873 echo "ref=$ref" >> "$GITHUB_OUTPUT"
5974
60- - name : Checkout repository
75+ - name : Checkout repository at release ref
6176 uses : actions/checkout@v6
6277 with :
6378 fetch-depth : 0
@@ -68,13 +83,14 @@ jobs:
6883 shell : bash
6984 run : |
7085 event_name="${{ github.event_name }}"
86+ nightly_tag="${{ steps.nightly-tag.outputs.nightly_tag }}"
7187 dispatch_tag=""
7288 if [ "$event_name" = "workflow_dispatch" ]; then
7389 dispatch_tag="$(jq -r '.inputs.tag // ""' "$GITHUB_EVENT_PATH")"
7490 fi
7591
7692 if [ "$event_name" = "schedule" ]; then
77- tag="$NIGHTLY_TAG "
93+ tag="$nightly_tag "
7894 elif [ "$event_name" = "push" ]; then
7995 tag="${GITHUB_REF_NAME}"
8096 elif [ -n "$dispatch_tag" ]; then
@@ -162,7 +178,7 @@ jobs:
162178 path : dashboard/AstrBot-${{ needs.resolve-release-context.outputs.tag }}-dashboard.zip
163179
164180 - name : Upload dashboard package to Cloudflare R2
165- if : ${{ env.R2_ACCOUNT_ID != '' && env.R2_ACCESS_KEY_ID != '' && env.R2_SECRET_ACCESS_KEY != '' && needs.resolve-release-context.outputs.tag != env.NIGHTLY_TAG }}
181+ if : ${{ env.R2_ACCOUNT_ID != '' && env.R2_ACCESS_KEY_ID != '' && env.R2_SECRET_ACCESS_KEY != '' && needs.resolve-release-context.outputs.tag != needs.resolve-release-context.outputs.nightly_tag }}
166182 env :
167183 R2_BUCKET_NAME : " astrbot"
168184 R2_OBJECT_NAME : " astrbot-webui-latest.zip"
@@ -191,8 +207,8 @@ jobs:
191207 name : Publish GitHub Release
192208 runs-on : ubuntu-24.04
193209 concurrency :
194- group : ${{ needs.resolve-release-context.outputs.tag == env.NIGHTLY_TAG && 'nightly-release' || format('release-{0}', needs.resolve-release-context.outputs.tag) }}
195- cancel-in-progress : ${{ needs.resolve-release-context.outputs.tag == env.NIGHTLY_TAG }}
210+ group : ${{ needs.resolve-release-context.outputs.tag == needs.resolve-release-context.outputs.nightly_tag && 'nightly-release' || format('release-{0}', needs.resolve-release-context.outputs.tag) }}
211+ cancel-in-progress : ${{ needs.resolve-release-context.outputs.tag == needs.resolve-release-context.outputs.nightly_tag }}
196212 needs :
197213 - resolve-release-context
198214 - verify-core
@@ -209,7 +225,8 @@ jobs:
209225 shell : bash
210226 run : |
211227 tag="${{ needs.resolve-release-context.outputs.tag }}"
212- if [ "$tag" = "$NIGHTLY_TAG" ]; then
228+ nightly_tag="${{ needs.resolve-release-context.outputs.nightly_tag }}"
229+ if [ "$tag" = "$nightly_tag" ]; then
213230 if ! short_sha="$(git rev-parse --short=8 HEAD 2>/tmp/git_rev_parse_error.log)"; then
214231 echo "Failed to resolve HEAD short SHA for nightly title." >&2
215232 cat /tmp/git_rev_parse_error.log >&2 || true
@@ -219,7 +236,7 @@ jobs:
219236 if [ -z "$base_version" ]; then
220237 base_version="v0.0.0"
221238 fi
222- title="${base_version}-${NIGHTLY_TAG }-${short_sha}"
239+ title="${base_version}-${nightly_tag }-${short_sha}"
223240 else
224241 base_version="$tag"
225242 title="$tag"
@@ -228,18 +245,19 @@ jobs:
228245 echo "base_version=$base_version" >> "$GITHUB_OUTPUT"
229246
230247 - name : Force-update nightly tag
231- if : ${{ needs.resolve-release-context.outputs.tag == env.NIGHTLY_TAG }}
248+ if : ${{ needs.resolve-release-context.outputs.tag == needs.resolve-release-context.outputs.nightly_tag }}
232249 env :
233250 GH_TOKEN : ${{ github.token }}
234251 shell : bash
235252 run : |
253+ nightly_tag="${{ needs.resolve-release-context.outputs.nightly_tag }}"
236254 if ! current_sha="$(git rev-parse HEAD 2>/tmp/git_rev_parse_error.log)"; then
237255 echo "Failed to resolve HEAD SHA before updating nightly tag." >&2
238256 cat /tmp/git_rev_parse_error.log >&2 || true
239257 exit 1
240258 fi
241- git tag -f "$NIGHTLY_TAG " "${current_sha}"
242- git push --force origin "refs/tags/${NIGHTLY_TAG }"
259+ git tag -f "$nightly_tag " "${current_sha}"
260+ git push --force origin "refs/tags/${nightly_tag }"
243261
244262 - name : Download dashboard artifact
245263 uses : actions/download-artifact@v8
@@ -253,7 +271,8 @@ jobs:
253271 shell : bash
254272 run : |
255273 tag="${{ needs.resolve-release-context.outputs.tag }}"
256- if [ "$tag" = "$NIGHTLY_TAG" ]; then
274+ nightly_tag="${{ needs.resolve-release-context.outputs.nightly_tag }}"
275+ if [ "$tag" = "$nightly_tag" ]; then
257276 note_file="$(mktemp)"
258277 python3 scripts/release/generate_nightly_release_notes.py \
259278 --base-tag "${{ steps.release-meta.outputs.base_version }}" \
@@ -275,14 +294,15 @@ jobs:
275294 run : |
276295 tag="${{ needs.resolve-release-context.outputs.tag }}"
277296 title="${{ steps.release-meta.outputs.title }}"
278- if [ "$tag" = "$NIGHTLY_TAG" ]; then
297+ nightly_tag="${{ needs.resolve-release-context.outputs.nightly_tag }}"
298+ if [ "$tag" = "$nightly_tag" ]; then
279299 pre_flag="--prerelease"
280300 else
281301 pre_flag=""
282302 fi
283303 if ! gh release view "$tag" >/dev/null 2>&1; then
284304 gh release create "$tag" --title "$title" --notes-file "${{ steps.notes.outputs.file }}" $pre_flag
285- elif [ "$tag" = "$NIGHTLY_TAG " ]; then
305+ elif [ "$tag" = "$nightly_tag " ]; then
286306 gh release edit "$tag" --title "$title" --notes-file "${{ steps.notes.outputs.file }}" --prerelease
287307 fi
288308
@@ -310,7 +330,7 @@ jobs:
310330
311331 publish-pypi :
312332 name : Publish PyPI
313- if : ${{ needs.resolve-release-context.outputs.tag != env.NIGHTLY_TAG }}
333+ if : ${{ needs.resolve-release-context.outputs.tag != needs.resolve-release-context.outputs.nightly_tag }}
314334 runs-on : ubuntu-24.04
315335 needs :
316336 - resolve-release-context
0 commit comments