Merge pull request #3787 from ikemen-engine/fix4 #1255
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| branches: [ develop, ci-test ] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Version tag (e.g. v1.0.0-rc.1). Leave empty to build the selected branch; develop builds nightly.' | |
| type: string | |
| required: false | |
| default: '' | |
| draft: | |
| description: 'Set as a draft release.' | |
| type: boolean | |
| required: false | |
| default: false | |
| discussionCategory: | |
| description: 'When provided this will generate a discussion of the specified category, e.g. Announcements.' | |
| type: string | |
| required: false | |
| default: '' | |
| buildAndroidApk: | |
| description: 'Build Android APK.' | |
| type: boolean | |
| required: false | |
| default: true | |
| permissions: | |
| contents: write | |
| name: releases | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| tag: | |
| name: prepare tag | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.meta.outputs.version }} | |
| releaseTag: ${{ steps.meta.outputs.releaseTag }} | |
| releaseKind: ${{ steps.meta.outputs.releaseKind }} | |
| artifactVersion: ${{ steps.meta.outputs.artifactVersion }} | |
| prerelease: ${{ steps.meta.outputs.prerelease }} | |
| makeLatest: ${{ steps.meta.outputs.makeLatest }} | |
| previousTag: ${{ steps.meta.outputs.previousTag }} | |
| buildTime: ${{ steps.meta.outputs.buildTime }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.sha }} | |
| fetch-depth: 0 | |
| - name: Set version | |
| id: meta | |
| shell: bash | |
| env: | |
| INPUT_TAG: ${{ github.event.inputs.tag }} | |
| run: | | |
| set -euo pipefail | |
| ref_name="$GITHUB_REF_NAME" | |
| input_tag="${INPUT_TAG:-}" | |
| previous_tag="" | |
| if [ -n "$input_tag" ]; then | |
| tag_pattern='^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-rc\.([1-9][0-9]*))?$' | |
| if [[ ! "$input_tag" =~ $tag_pattern ]]; then | |
| echo "Invalid release tag: $input_tag" >&2 | |
| echo "Use vX.Y.Z or vX.Y.Z-rc.N." >&2 | |
| exit 1 | |
| fi | |
| release_major="${BASH_REMATCH[1]}" | |
| release_minor="${BASH_REMATCH[2]}" | |
| release_patch="${BASH_REMATCH[3]}" | |
| release_branch="release/${release_major}.${release_minor}" | |
| if [ "$ref_name" != "$release_branch" ]; then | |
| echo "Run $input_tag from the $release_branch branch." >&2 | |
| exit 1 | |
| fi | |
| if git ls-remote --exit-code --tags origin "refs/tags/$input_tag" >/dev/null 2>&1; then | |
| echo "Tag $input_tag already exists and will not be replaced." >&2 | |
| exit 1 | |
| fi | |
| git fetch --force --tags origin | |
| latest_stable="$(git tag --list 'v[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | grep -Ev -- '-' | sed -n '1p' || true)" | |
| if [[ "$input_tag" == *-rc.* ]]; then | |
| base_tag="${input_tag%-rc.*}" | |
| previous_tag="$(git tag --list "${base_tag}-rc.*" --sort=-v:refname | sed -n '1p')" | |
| fi | |
| if [ -z "$previous_tag" ]; then | |
| stable_pattern='v[0-9]*.[0-9]*.[0-9]*' | |
| if [ "$release_patch" -gt 0 ]; then | |
| stable_pattern="v${release_major}.${release_minor}.*" | |
| fi | |
| previous_tag="$(git tag --list "$stable_pattern" --sort=-v:refname | grep -Ev -- '-' | sed -n '1p' || true)" | |
| fi | |
| version="$input_tag" | |
| release_tag="$input_tag" | |
| artifact_version="$input_tag" | |
| release_kind="tagged" | |
| if [[ "$input_tag" == *-rc.* ]]; then | |
| prerelease="true" | |
| make_latest="false" | |
| else | |
| prerelease="false" | |
| if [ -z "$latest_stable" ] || [ "$(printf '%s\n%s\n' "$latest_stable" "$input_tag" | sort -V | sed -n '$p')" = "$input_tag" ]; then | |
| make_latest="true" | |
| else | |
| make_latest="false" | |
| fi | |
| fi | |
| elif [ "$ref_name" = "ci-test" ]; then | |
| version="ci-test" | |
| release_tag="ci-test" | |
| artifact_version="ci-test" | |
| release_kind="ci-test" | |
| prerelease="true" | |
| make_latest="false" | |
| elif [ "${{ github.event_name }}" = "workflow_dispatch" ] && \ | |
| [ "$ref_name" != "develop" ]; then | |
| version="$ref_name" | |
| release_tag="$ref_name" | |
| artifact_version="$(printf '%s' "$ref_name" | sed 's#[^A-Za-z0-9._-]#-#g')" | |
| release_kind="branch" | |
| prerelease="true" | |
| make_latest="false" | |
| else | |
| version="nightly" | |
| release_tag="nightly" | |
| artifact_version="nightly" | |
| release_kind="nightly" | |
| prerelease="false" | |
| make_latest="true" | |
| fi | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "releaseTag=$release_tag" >> "$GITHUB_OUTPUT" | |
| echo "releaseKind=$release_kind" >> "$GITHUB_OUTPUT" | |
| echo "artifactVersion=$artifact_version" >> "$GITHUB_OUTPUT" | |
| echo "prerelease=$prerelease" >> "$GITHUB_OUTPUT" | |
| echo "makeLatest=$make_latest" >> "$GITHUB_OUTPUT" | |
| echo "previousTag=$previous_tag" >> "$GITHUB_OUTPUT" | |
| echo "buildTime=$(date -u '+%Y.%m.%d')" >> "$GITHUB_OUTPUT" | |
| build: | |
| name: prepare release | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| needs: tag | |
| strategy: | |
| matrix: | |
| cfg: | |
| - runner_os: windows | |
| os: windows-2022 | |
| goos: windows | |
| goarch: amd64 | |
| bin: Ikemen_GO.exe | |
| glibc: '' | |
| target: '' | |
| build_target: Win64 | |
| - runner_os: linux | |
| os: ubuntu-22.04 | |
| goos: linux | |
| goarch: amd64 | |
| bin: Ikemen_GO_Linux | |
| glibc: '2.13' | |
| target: '' | |
| build_target: Linux | |
| - runner_os: macos | |
| os: macos-14 # macos-13 | |
| goos: darwin | |
| goarch: arm64 # amd64 | |
| bin: Ikemen_GO_MacOSARM # Ikemen_GO_MacOS | |
| glibc: '' | |
| target: '10.7' | |
| build_target: MacOSARM # MacOS | |
| - runner_os: android | |
| os: ubuntu-22.04 | |
| goos: android | |
| goarch: arm64 | |
| bin: ikemen-go.apk | |
| glibc: '' | |
| target: '' | |
| build_target: Android | |
| runs-on: ${{ matrix.cfg.os }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.sha }} | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.20.x' | |
| cache: true | |
| cache-dependency-path: | | |
| go.sum | |
| **/go.sum | |
| - name: Setup MSYS2 (Windows) | |
| if: ${{ matrix.cfg.runner_os == 'windows' }} | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| path-type: inherit | |
| install: >- | |
| git | |
| make | |
| diffutils | |
| mingw-w64-x86_64-pkg-config | |
| mingw-w64-x86_64-toolchain | |
| mingw-w64-x86_64-bzip2 | |
| mingw-w64-x86_64-nasm | |
| mingw-w64-x86_64-tools-git | |
| mingw-w64-x86_64-SDL2 | |
| mingw-w64-x86_64-yasm | |
| mingw-w64-x86_64-libxmp | |
| - name: Prepare Vulkan SDK | |
| uses: humbletim/setup-vulkan-sdk@v1.2.1 | |
| with: | |
| vulkan-query-version: 1.4.304.1 | |
| vulkan-components: Vulkan-Headers, Vulkan-Loader | |
| vulkan-use-cache: true | |
| - name: Install dependencies | |
| if: ${{ matrix.cfg.runner_os != 'android' }} | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" = "Linux" ]; then | |
| sudo apt-get update && sudo apt-get install -y libasound2-dev libgl1-mesa-dev xorg-dev libgtk-3-dev \ | |
| build-essential pkg-config git yasm nasm curl ca-certificates libxmp-dev libsdl2-dev | |
| fi | |
| if [ "$RUNNER_OS" = "macOS" ]; then | |
| # Avoid update, disable analytics, prefer taps over API, and retry. | |
| export HOMEBREW_NO_ANALYTICS=1 | |
| export HOMEBREW_NO_AUTO_UPDATE=1 | |
| export HOMEBREW_NO_INSTALL_FROM_API=1 | |
| brew update-reset || true | |
| ( brew install --quiet pkg-config git nasm libxmp sdl2 molten-vk ) || ( | |
| echo "First attempt failed; retrying with API mode..." >&2 | |
| unset HOMEBREW_NO_INSTALL_FROM_API | |
| brew install --quiet pkg-config git nasm libxmp sdl2 molten-vk | |
| ) | |
| fi | |
| - name: Generate LICENSES.txt | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| # One LICENSES.txt for ALL platforms (including Android). | |
| # Must exist BEFORE Android Docker Compose runs so it is visible in the bind-mounted workspace. | |
| FFMPEG_REV="${FFMPEG_REV:-release/7.1}" | |
| SCREENPACK_LIC="https://raw.githubusercontent.com/ikemen-engine/Ikemen-GO-Screenpack/master/LICENCE.txt" | |
| FFMPEG_LGPL="https://raw.githubusercontent.com/FFmpeg/FFmpeg/${FFMPEG_REV}/COPYING.LGPLv2.1" | |
| FFMPEG_LICENSE_MD="https://raw.githubusercontent.com/FFmpeg/FFmpeg/${FFMPEG_REV}/LICENSE.md" | |
| FFMPEG_CREDITS="https://raw.githubusercontent.com/FFmpeg/FFmpeg/${FFMPEG_REV}/CREDITS" | |
| LIBXMP_README="https://raw.githubusercontent.com/libxmp/libxmp/master/README" | |
| SDL2_LICENSE="https://raw.githubusercontent.com/libsdl-org/SDL/main/LICENSE.txt" | |
| { | |
| echo "=============================" | |
| echo " Ikemen GO - LICENSES.txt" | |
| echo "=============================" | |
| echo | |
| echo "Section 1: Ikemen GO (MIT)" | |
| echo "--------------------------" | |
| cat LICENCE.txt | |
| echo | |
| echo "Section 2: Bundled Assets (Creative Commons)" | |
| echo "-------------------------------------------" | |
| echo "Screenpack license from Ikemen-GO-Screenpack/LICENCE.txt:" | |
| echo | |
| curl -fsSL "$SCREENPACK_LIC" | |
| echo | |
| echo "Section 3: FFmpeg (LGPL v2.1) and Notices" | |
| echo "-----------------------------------------" | |
| echo "This program dynamically links FFmpeg under the GNU Lesser General Public License v2.1." | |
| echo "The exact corresponding FFmpeg source is attached to the release page as:" | |
| echo " src_ffmpeg.tar.gz" | |
| echo | |
| echo "3.1 Full LGPL v2.1 license text:" | |
| echo "--------------------------------" | |
| curl -fsSL "$FFMPEG_LGPL" | |
| echo | |
| echo "3.2 FFmpeg LICENSE.md:" | |
| echo "----------------------" | |
| curl -fsSL "$FFMPEG_LICENSE_MD" | |
| echo | |
| echo "3.3 FFmpeg CREDITS:" | |
| echo "-------------------" | |
| curl -fsSL "$FFMPEG_CREDITS" | |
| echo | |
| echo "Section 4: libxmp and Notices" | |
| echo "-----------------------------" | |
| echo "Upstream: https://github.com/libxmp/libxmp" | |
| echo | |
| echo "libxmp README (contains license info):" | |
| echo "-------------------------------------" | |
| curl -fsSL "$LIBXMP_README" | |
| echo | |
| echo "Section 5: SDL2 and Notices" | |
| echo "---------------------------" | |
| echo "Upstream: https://github.com/libsdl-org/SDL" | |
| echo | |
| echo "SDL2 LICENSE (zlib):" | |
| echo "--------------------" | |
| curl -fsSL "$SDL2_LICENSE" | |
| echo | |
| } > LICENSES.txt | |
| - name: Build (POSIX) | |
| if: ${{ runner.os != 'Windows' && matrix.cfg.runner_os != 'android' }} | |
| shell: bash | |
| env: | |
| BUILD_FFMPEG: "yes" | |
| GOOS: ${{ matrix.cfg.goos }} | |
| GOARCH: ${{ matrix.cfg.goarch }} | |
| CGO_ENABLED: "1" | |
| GOEXPERIMENT: "arenas" | |
| APP_VERSION: ${{ needs.tag.outputs.version }} | |
| APP_BUILDTIME: ${{ needs.tag.outputs.buildTime }} | |
| run: | | |
| go env -w GO111MODULE=on | |
| go mod download | |
| ./build/build.sh ${{ matrix.cfg.build_target }} | |
| if [ "$RUNNER_OS" = "macOS" ]; then | |
| make appbundle BINNAME=bin/${{ matrix.cfg.bin }} | |
| fi | |
| - name: Build Android (Docker Compose) | |
| if: ${{ matrix.cfg.runner_os == 'android' && (github.event_name != 'workflow_dispatch' || github.event.inputs.buildAndroidApk != 'false') }} | |
| shell: bash | |
| env: | |
| # Build APK is optional but enabled by default. If disabled, we skip this entire step. | |
| BUILD_ANDROID_APK: ${{ (github.event_name != 'workflow_dispatch' || github.event.inputs.buildAndroidApk != 'false') && '1' || '0' }} | |
| APP_VERSION: ${{ needs.tag.outputs.version }} | |
| APP_BUILDTIME: ${{ needs.tag.outputs.buildTime }} | |
| run: | | |
| set -euo pipefail | |
| echo "==> Docker sanity:" | |
| docker version | |
| docker compose version | |
| echo | |
| echo "==> Building Android (APK via Docker Compose)..." | |
| chmod +x build/build_android.sh | |
| ./build/build_android.sh | |
| echo | |
| echo "==> Outputs:" | |
| ls -lah bin/ lib/ || true | |
| test -f bin/libmain.so | |
| test -f bin/ikemen-go.apk | |
| - name: Build (MSYS2) | |
| if: ${{ runner.os == 'Windows' }} | |
| shell: 'msys2 {0}' | |
| env: | |
| BUILD_FFMPEG: "yes" | |
| GOOS: ${{ matrix.cfg.goos }} | |
| GOARCH: ${{ matrix.cfg.goarch }} | |
| CGO_ENABLED: "1" | |
| GOEXPERIMENT: "arenas" | |
| APP_VERSION: ${{ needs.tag.outputs.version }} | |
| APP_BUILDTIME: ${{ needs.tag.outputs.buildTime }} | |
| run: | | |
| go env -w GO111MODULE=on | |
| go mod download | |
| ./build/build.sh ${{ matrix.cfg.build_target }} | |
| - name: Prepare FFmpeg artifacts | |
| if: ${{ matrix.cfg.runner_os == 'linux' }} | |
| id: artifacts_ffmpeg | |
| shell: bash | |
| run: | | |
| # Android build runs in Docker and may create root-owned git dirs; allow them. | |
| git config --global --add safe.directory "$GITHUB_WORKSPACE/build/ffmpeg-src" >/dev/null 2>&1 || true | |
| mkdir -p FFmpeg-CS | |
| # Export the *exact* tree | |
| ( cd build/ffmpeg-src && git archive --format=tar HEAD ) | tar -x -C FFmpeg-CS | |
| cp build/ffmpeg-src/config.h FFmpeg-CS/ 2>/dev/null || true | |
| cp build/ffmpeg-src/config.log FFmpeg-CS/ 2>/dev/null || true | |
| cp build/ffmpeg-src/BUILDINFO.txt FFmpeg-CS/ 2>/dev/null || true | |
| tar -czf "src_ffmpeg.tar.gz" FFmpeg-CS | |
| echo "artifact_ffsrc=src_ffmpeg.tar.gz" >> "$GITHUB_OUTPUT" | |
| - name: Prepare release artifacts | |
| if: ${{ matrix.cfg.runner_os != 'android' || (github.event_name != 'workflow_dispatch' || github.event.inputs.buildAndroidApk != 'false') }} | |
| id: artifacts | |
| shell: bash | |
| run: | | |
| echo "Preparing files for deployment" | |
| mkdir -p deploy | |
| if [ "${{ matrix.cfg.runner_os }}" = "android" ]; then | |
| echo "==> Preparing Android release artifact" | |
| mkdir -p deploy/lib | |
| cp -av bin/ikemen-go.apk deploy/ || true | |
| cp -av bin/libmain.so bin/libmain.h deploy/ 2>/dev/null || true | |
| cp -av lib/*.so* deploy/lib/ 2>/dev/null || true | |
| cp README.md deploy/ 2>/dev/null || true | |
| cp -av LICENSES.txt deploy/ 2>/dev/null || true | |
| cd deploy | |
| if [ "${{ needs.tag.outputs.releaseKind }}" = "nightly" ]; then | |
| ARTIFACT_NAME=Ikemen_GO-dev-android.zip | |
| echo "artifact=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" | |
| else | |
| ARTIFACT_NAME=Ikemen_GO-${{ needs.tag.outputs.artifactVersion }}-android.zip | |
| echo "artifact=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" | |
| fi | |
| zip -r ../$ARTIFACT_NAME * | |
| echo "Successfully prepared Android assets for deployment" | |
| exit 0 | |
| fi | |
| mkdir -p deploy/data | |
| # 1) Put binary and shared libs generated by build.sh | |
| if [ "$RUNNER_OS" = "macOS" ]; then | |
| cp -r I.K.E.M.E.N-Go.app deploy/ | |
| mkdir -p deploy/I.K.E.M.E.N-Go.app/Contents/Frameworks | |
| if ls lib/*.dylib >/dev/null 2>&1; then | |
| cp -av lib/*.dylib deploy/I.K.E.M.E.N-Go.app/Contents/Frameworks/ 2>/dev/null || true | |
| fi | |
| else | |
| cp "./${{ matrix.cfg.bin }}" deploy/ | |
| mkdir -p deploy/lib | |
| cp -r lib/* deploy/lib/ 2>/dev/null || true | |
| fi | |
| # 2) Bring in runtime assets | |
| git clone https://github.com/ikemen-engine/Ikemen-GO-Screenpack.git | |
| cp -r data font external \ | |
| Ikemen-GO-Screenpack/chars \ | |
| Ikemen-GO-Screenpack/data \ | |
| Ikemen-GO-Screenpack/font \ | |
| Ikemen-GO-Screenpack/sound \ | |
| Ikemen-GO-Screenpack/stages \ | |
| Ikemen-GO-Screenpack/video \ | |
| deploy/ | |
| # 3) Include readme | |
| cp README.md deploy/ | |
| # 4) Single LICENSES.txt | |
| cp -av LICENSES.txt deploy/ 2>/dev/null || true | |
| # 5) Extra runtime db | |
| GAMEPAD_DB_URL="https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt" | |
| echo "Downloading SDL GameController DB..." | |
| curl -L "$GAMEPAD_DB_URL" -o deploy/external/gamecontrollerdb.txt | |
| # 6) system.base.def | |
| cp src/resources/defaultMotif.ini deploy/data/system.base.def | |
| # 7) Archive | |
| echo "Zipping deploy directory" | |
| cd deploy | |
| # Linux desktop integration: ship .desktop + 256px icon | |
| if [ "$RUNNER_OS" = "Linux" ]; then | |
| #mkdir -p icons/hicolor/256x256/apps | |
| #cp ../external/icons/IkemenCylia_256.png icons/hicolor/256x256/apps/ikemen-go.png | |
| cp ../external/icons/IkemenCylia_256.png ikemen-go.png | |
| cat > Ikemen_GO.desktop <<'EOF' | |
| [Desktop Entry] | |
| Name=Ikemen GO | |
| Comment=An open-source fighting game engine | |
| TryExec=Ikemen_GO_Linux | |
| Exec=./Ikemen_GO_Linux | |
| Icon=ikemen-go.png | |
| Terminal=false | |
| Type=Application | |
| Categories=Game;ArcadeGame; | |
| EOF | |
| fi | |
| if [ "${{ needs.tag.outputs.releaseKind }}" = "nightly" ]; then | |
| ARTIFACT_NAME=Ikemen_GO-dev-${{ matrix.cfg.runner_os }}.zip | |
| echo "artifact=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" | |
| else | |
| ARTIFACT_NAME=Ikemen_GO-${{ needs.tag.outputs.artifactVersion }}-${{ matrix.cfg.runner_os }}.zip | |
| echo "artifact=$ARTIFACT_NAME" >> "$GITHUB_OUTPUT" | |
| fi | |
| if [ "$RUNNER_OS" = "Windows" ]; then | |
| "/c/Program Files/7-Zip/7z.exe" a ../$ARTIFACT_NAME * | |
| else | |
| cp ../build/Ikemen_GO.command . | |
| zip -r ../$ARTIFACT_NAME * | |
| fi | |
| echo "Successfully prepared assets for deployment" | |
| - name: Stage release artifacts | |
| if: ${{ steps.artifacts.outputs.artifact != '' }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p release-files | |
| cp -v "${{ steps.artifacts.outputs.artifact }}" release-files/ | |
| if [ "${{ matrix.cfg.runner_os }}" = "linux" ] && \ | |
| [ -n "${{ steps.artifacts_ffmpeg.outputs.artifact_ffsrc }}" ]; then | |
| cp -v "${{ steps.artifacts_ffmpeg.outputs.artifact_ffsrc }}" release-files/ | |
| fi | |
| - name: Upload release artifacts | |
| if: ${{ steps.artifacts.outputs.artifact != '' }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-${{ matrix.cfg.runner_os }} | |
| path: release-files/* | |
| if-no-files-found: error | |
| release: | |
| name: publish release | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| needs: [tag, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out source for rolling tag update | |
| if: ${{ needs.tag.outputs.releaseKind == 'nightly' || needs.tag.outputs.releaseKind == 'ci-test' }} | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.sha }} | |
| fetch-depth: 0 | |
| path: source | |
| - name: Download release artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: release-* | |
| path: release-assets | |
| merge-multiple: true | |
| - name: List release artifacts | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| find release-assets -maxdepth 1 -type f -print -exec ls -lh {} \; | |
| - name: Generate checksums | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| (cd release-assets && sha256sum * > SHA256SUMS.txt) | |
| - name: Move rolling tag to this commit | |
| if: ${{ needs.tag.outputs.releaseKind == 'nightly' || needs.tag.outputs.releaseKind == 'ci-test' }} | |
| working-directory: source | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| tag="${{ needs.tag.outputs.releaseTag }}" | |
| git fetch --force --tags origin | |
| git tag -fa "$tag" "$GITHUB_SHA" -m "$tag: $GITHUB_SHA" | |
| git push --force origin "refs/tags/$tag:refs/tags/$tag" | |
| - name: Recreate rolling release metadata | |
| if: ${{ needs.tag.outputs.releaseKind == 'nightly' || needs.tag.outputs.releaseKind == 'ci-test' }} | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.IKEMEN_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| # The rolling tag has already been force-moved after all builds succeeded. | |
| # Delete only the GitHub Release object so it is recreated with fresh metadata. | |
| # Do not use --cleanup-tag, because that would delete the moved tag too. | |
| tag="${{ needs.tag.outputs.releaseTag }}" | |
| if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then | |
| gh release delete "$tag" --repo "$GITHUB_REPOSITORY" --yes | |
| fi | |
| - name: Prepare nightly release notes | |
| if: ${{ needs.tag.outputs.releaseKind == 'nightly' }} | |
| shell: bash | |
| run: | | |
| cat > nightly-release.md <<'EOF' | |
| The nightly release is generated after each commit to `develop` and contains the newest engine and screenpack files. It is intended for testing and may contain regressions or changes not yet covered by the stable documentation. | |
| EOF | |
| - name: Publish release | |
| uses: ncipollo/release-action@v1.21.0 | |
| with: | |
| token: ${{ secrets.IKEMEN_TOKEN }} | |
| artifactErrorsFailBuild: true | |
| artifacts: "release-assets/*" | |
| commit: ${{ github.sha }} | |
| tag: ${{ needs.tag.outputs.releaseTag }} | |
| name: ${{ needs.tag.outputs.releaseTag }} | |
| # Rolling and temporary releases may be updated. | |
| # Tagged RC/stable releases are immutable. | |
| allowUpdates: ${{ needs.tag.outputs.releaseKind != 'tagged' }} | |
| replacesArtifacts: ${{ needs.tag.outputs.releaseKind != 'tagged' }} | |
| immutableCreate: ${{ needs.tag.outputs.releaseKind == 'tagged' && !inputs.draft }} | |
| prerelease: ${{ needs.tag.outputs.prerelease }} | |
| makeLatest: ${{ needs.tag.outputs.makeLatest }} | |
| # Only tagged releases receive automatically generated notes. | |
| generateReleaseNotes: ${{ needs.tag.outputs.releaseKind == 'tagged' }} | |
| generateReleaseNotesPreviousTag: ${{ needs.tag.outputs.previousTag }} | |
| # Only rolling releases use the prepared custom body. | |
| bodyFile: ${{ needs.tag.outputs.releaseKind == 'nightly' && 'nightly-release.md' || '' }} | |
| # These settings apply only to manually dispatched temporary or | |
| # versioned releases. They evaluate to empty/false for rolling builds. | |
| discussionCategory: ${{ (needs.tag.outputs.releaseKind == 'branch' || needs.tag.outputs.releaseKind == 'tagged') && inputs.discussionCategory || '' }} | |
| draft: ${{ (needs.tag.outputs.releaseKind == 'branch' || needs.tag.outputs.releaseKind == 'tagged') && inputs.draft }} | |
| # Preserve manually edited rolling/temporary release metadata when | |
| # updating an existing release. | |
| omitBodyDuringUpdate: ${{ needs.tag.outputs.releaseKind == 'branch' }} | |
| omitDraftDuringUpdate: ${{ needs.tag.outputs.releaseKind != 'tagged' }} | |
| omitNameDuringUpdate: ${{ needs.tag.outputs.releaseKind != 'tagged' }} | |
| omitPrereleaseDuringUpdate: ${{ needs.tag.outputs.releaseKind != 'tagged' }} | |
| removeArtifacts: false | |
| skipIfReleaseExists: false | |
| updateOnlyUnreleased: false |