@@ -39,6 +39,11 @@ permissions:
3939 contents : write
4040
4141name : releases
42+
43+ concurrency :
44+ group : ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || 'nightly' }}
45+ cancel-in-progress : true
46+
4247jobs :
4348 tag :
4449 name : prepare tag
5358 steps :
5459 - uses : actions/checkout@v6
5560 with :
56- ref : ${{ github.ref }}
61+ ref : ${{ github.sha }}
62+ fetch-depth : 0
5763
5864 # - name: Get previous tag
5965 # id: previousTag
9096 echo "releaseKind=$release_kind" >> "$GITHUB_OUTPUT"
9197 echo "buildTime=$(date '+%Y.%m.%d')" >> "$GITHUB_OUTPUT"
9298
99+ - name : Move nightly tag to this commit
100+ if : ${{ steps.meta.outputs.releaseKind == 'nightly' }}
101+ shell : bash
102+ run : |
103+ set -euo pipefail
104+
105+ git config user.name "github-actions[bot]"
106+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
107+
108+ tag="${{ steps.meta.outputs.releaseTag }}"
109+
110+ git fetch --force --tags origin
111+ git tag -fa "$tag" "$GITHUB_SHA" -m "$tag: $GITHUB_SHA"
112+ git push --force origin "refs/tags/$tag:refs/tags/$tag"
113+
93114 build :
94115 name : prepare release
95116 if : ${{ github.actor != 'dependabot[bot]' }}
@@ -133,14 +154,16 @@ jobs:
133154 steps :
134155 - uses : actions/checkout@v6
135156 with :
136- ref : ${{ github.ref }}
157+ ref : ${{ github.sha }}
137158
138- - name : Setup Golang with cache
139- uses : magnetikonline/action-golang-cache@v5
159+ - name : Setup Go
160+ uses : actions/setup-go@v6
140161 with :
141- go-version : ~1.20
142- # go-version-file: go.mod
143- # cache-key-suffix: -ikemen
162+ go-version : ' 1.20.x'
163+ cache : true
164+ cache-dependency-path : |
165+ go.sum
166+ **/go.sum
144167
145168 - name : Setup MSYS2 (Windows)
146169 if : ${{ matrix.cfg.runner_os == 'windows' }}
@@ -439,14 +462,71 @@ jobs:
439462 fi
440463 echo "Successfully prepared assets for deployment"
441464
465+ - name : Stage release artifacts
466+ if : ${{ steps.artifacts.outputs.artifact != '' }}
467+ shell : bash
468+ run : |
469+ set -euo pipefail
470+ mkdir -p release-files
471+
472+ cp -v "${{ steps.artifacts.outputs.artifact }}" release-files/
473+
474+ if [ "${{ matrix.cfg.runner_os }}" = "linux" ] && \
475+ [ -n "${{ steps.artifacts_ffmpeg.outputs.artifact_ffsrc }}" ]; then
476+ cp -v "${{ steps.artifacts_ffmpeg.outputs.artifact_ffsrc }}" release-files/
477+ fi
478+
479+ - name : Upload release artifacts
480+ if : ${{ steps.artifacts.outputs.artifact != '' }}
481+ uses : actions/upload-artifact@v6
482+ with :
483+ name : release-${{ matrix.cfg.runner_os }}
484+ path : release-files/*
485+ if-no-files-found : error
486+
487+ release :
488+ name : publish release
489+ if : ${{ github.actor != 'dependabot[bot]' }}
490+ needs : [tag, build]
491+ runs-on : ubuntu-latest
492+ steps :
493+ - name : Download release artifacts
494+ uses : actions/download-artifact@v7
495+ with :
496+ pattern : release-*
497+ path : release-assets
498+ merge-multiple : true
499+
500+ - name : List release artifacts
501+ shell : bash
502+ run : |
503+ set -euo pipefail
504+ find release-assets -maxdepth 1 -type f -print -exec ls -lh {} \;
505+
506+ - name : Recreate nightly release metadata
507+ if : ${{ needs.tag.outputs.releaseKind == 'nightly' }}
508+ shell : bash
509+ env :
510+ GH_TOKEN : ${{ secrets.IKEMEN_TOKEN }}
511+ run : |
512+ set -euo pipefail
513+
514+ # The nightly tag has already been force-moved in the prepare tag job.
515+ # Delete only the GitHub Release object so GitHub republishes it with fresh metadata.
516+ # Do NOT pass --cleanup-tag here, because that would delete the moved nightly tag too.
517+ if gh release view nightly --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
518+ gh release delete nightly --repo "$GITHUB_REPOSITORY" --yes
519+ fi
520+
442521 - name : Update dev release
443- if : " ${{ needs.tag.outputs.releaseKind == 'nightly' && steps.artifacts.outputs.artifact != '' }} "
522+ if : ${{ needs.tag.outputs.releaseKind == 'nightly' }}
444523 uses : ncipollo/release-action@v1
445524 with :
446525 token : ${{ secrets.IKEMEN_TOKEN }}
447526 allowUpdates : true
448527 artifactErrorsFailBuild : true
449- artifacts : " ${{ steps.artifacts.outputs.artifact }}${{ matrix.cfg.runner_os == 'linux' && format(',{0}', steps.artifacts_ffmpeg.outputs.artifact_ffsrc) || '' }}"
528+ artifacts : " release-assets/*"
529+ commit : ${{ github.sha }}
450530 body : |
451531 The nightly release, or more precisely, the latest development version, is generated after each commit and always represents the most up-to-date iteration of the source code. It features the newest development version of the engine and screenpack files, making it ready for testing straightaway. Using it can eliminate the need to compile the source code for the latest, cutting-edge updates. However, as a consequence, it may sometimes contain regressions that were not yet discovered and/or outpace the documentation that corresponds to stable releases with version numbers like v x.x.x.
452532 discussionCategory : " "
@@ -467,14 +547,27 @@ jobs:
467547 tag : nightly
468548 updateOnlyUnreleased : false
469549
550+ - name : Verify nightly release metadata
551+ if : ${{ needs.tag.outputs.releaseKind == 'nightly' }}
552+ shell : bash
553+ env :
554+ GH_TOKEN : ${{ secrets.IKEMEN_TOKEN }}
555+ run : |
556+ set -euo pipefail
557+ gh release view nightly \
558+ --repo "$GITHUB_REPOSITORY" \
559+ --json tagName,name,isPrerelease,isDraft,createdAt,publishedAt,url \
560+ --jq .
561+
470562 - name : Create Release
471- if : " ${{ needs.tag.outputs.releaseKind != 'nightly' && steps.artifacts.outputs.artifact != '' }} "
563+ if : ${{ needs.tag.outputs.releaseKind != 'nightly' }}
472564 uses : ncipollo/release-action@v1
473565 with :
474566 token : ${{ secrets.IKEMEN_TOKEN }}
475567 allowUpdates : true
476568 artifactErrorsFailBuild : true
477- artifacts : " ${{ steps.artifacts.outputs.artifact }}${{ matrix.cfg.runner_os == 'linux' && format(',{0}', steps.artifacts_ffmpeg.outputs.artifact_ffsrc) || '' }}"
569+ artifacts : " release-assets/*"
570+ commit : ${{ github.sha }}
478571 # body: |
479572 # ${{ needs.tag.outputs.changelog }}
480573 discussionCategory : ${{ github.event.inputs.discussionCategory }}
0 commit comments