Merge pull request #2978 from ikemen-engine/fix7 #876
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 ] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag for the new release. Use semantic versioning e.g. v1.0.0. Leave empty to only update the nightly build.' | |
| type: string | |
| required: false | |
| default: '' | |
| prerelease: | |
| description: 'Set as a pre-release.' | |
| type: boolean | |
| required: false | |
| default: false | |
| makeLatest: | |
| description: 'Set as the latest release.' | |
| type: boolean | |
| required: false | |
| default: true | |
| 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: '' | |
| permissions: | |
| checks: write | |
| contents: write | |
| name: releases | |
| jobs: | |
| tag: | |
| name: prepare tag | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ env.version }} | |
| buildTime: ${{ env.buildTime }} | |
| #previousTag: ${{ steps.previousTag.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| #- name: Get previous tag | |
| # id: previousTag | |
| # uses: actions-ecosystem/action-get-latest-tag@v1 | |
| # with: | |
| # semver_only: true | |
| - name: Set version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event.inputs.tag }}" != "" ]; then | |
| echo "version=${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
| else | |
| echo "version=nightly" >> $GITHUB_ENV | |
| fi | |
| echo "buildTime=$(date '+%Y.%m.%d')" >> $GITHUB_ENV | |
| 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 | |
| runs-on: ${{ matrix.cfg.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Golang with cache | |
| uses: magnetikonline/action-golang-cache@v5 | |
| with: | |
| go-version: ~1.20 | |
| #go-version-file: go.mod | |
| #cache-key-suffix: -ikemen | |
| - 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 | |
| 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: Build (POSIX) | |
| if: ${{ runner.os != 'Windows' }} | |
| 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 (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 == 'windows' }} | |
| id: artifacts_ffmpeg | |
| shell: bash | |
| run: | | |
| 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 | |
| id: artifacts | |
| shell: bash | |
| run: | | |
| echo "Preparing files for deployment" | |
| mkdir -p deploy | |
| 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-Elecbyte-Screenpack.git | |
| cp -r data font external \ | |
| Ikemen_GO-Elecbyte-Screenpack/chars \ | |
| Ikemen_GO-Elecbyte-Screenpack/data \ | |
| Ikemen_GO-Elecbyte-Screenpack/font \ | |
| Ikemen_GO-Elecbyte-Screenpack/sound \ | |
| Ikemen_GO-Elecbyte-Screenpack/stages \ | |
| Ikemen_GO-Elecbyte-Screenpack/video \ | |
| deploy/ | |
| # 3) Include readme | |
| cp README.md deploy/ | |
| # 4) Build a single LICENSES.txt dynamically | |
| { | |
| 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-Elecbyte-Screenpack/LICENCE.txt:" | |
| echo | |
| cat Ikemen_GO-Elecbyte-Screenpack/LICENCE.txt | |
| echo | |
| echo "Note: Some assets in the engine repo are under CC-BY 3.0 as noted in the MIT section above." | |
| 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 FFmpeg shared libraries are included in this archive so the app runs out of the box." | |
| 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 (from FFmpeg/COPYING.LGPLv2.1):" | |
| echo "----------------------------------------------------------------" | |
| cat build/ffmpeg-src/COPYING.LGPLv2.1 | |
| echo | |
| echo "3.2 FFmpeg LICENSE.md:" | |
| echo "----------------------" | |
| cat build/ffmpeg-src/LICENSE.md | |
| echo | |
| echo "3.3 FFmpeg CREDITS:" | |
| echo "-------------------" | |
| cat build/ffmpeg-src/CREDITS | |
| echo | |
| echo "3.4 FFmpeg shared objects shipped in this archive:" | |
| echo "-----------------------------------------------" | |
| if [ "$RUNNER_OS" = "Windows" ]; then | |
| ( cd deploy/lib 2>/dev/null && ls -1 *.dll 2>/dev/null || true ) | |
| elif [ "$RUNNER_OS" = "Linux" ]; then | |
| ( cd deploy/lib 2>/dev/null && ls -1 *.so* 2>/dev/null || true ) | |
| else | |
| ( cd deploy/I.K.E.M.E.N-Go.app/Contents/Frameworks 2>/dev/null && ls -1 *.dylib 2>/dev/null || true ) | |
| fi | |
| echo | |
| echo "Section 4: libxmp and Notices" | |
| echo "-----------------------------" | |
| echo "This program dynamically links libxmp for module music playback." | |
| echo "Upstream: https://github.com/libxmp/libxmp" | |
| echo | |
| echo "libxmp LICENSE (fetched from upstream README at build time):" | |
| echo "-----------------------------------------------------------" | |
| set -o pipefail | |
| curl -fsSL https://raw.githubusercontent.com/libxmp/libxmp/master/README | awk '/^LICENSE$/{p=1} p' | |
| echo | |
| echo "Section 5: SDL2 and Notices" | |
| echo "---------------------------" | |
| echo "This program uses SDL2 for windowing, input, controller support." | |
| echo "Upstream: https://github.com/libsdl-org/SDL" | |
| echo | |
| echo "SDL2 LICENSE (zlib, fetched from upstream LICENSE.txt):" | |
| echo "-------------------------------------------------------" | |
| curl -fsSL https://raw.githubusercontent.com/libsdl-org/SDL/main/LICENSE.txt | |
| echo | |
| } > deploy/LICENSES.txt | |
| # 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 [ "${{ github.event.inputs.tag }}" = "" ]; 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.version }}-${{ 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: Update dev release | |
| if: "${{ github.event.inputs.tag == '' }}" | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.IKEMEN_TOKEN }} | |
| allowUpdates: true | |
| artifactErrorsFailBuild: true | |
| artifacts: "${{ steps.artifacts.outputs.artifact }},${{ steps.artifacts_ffmpeg.outputs.artifact_ffsrc }}" | |
| body: | | |
| 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. | |
| discussionCategory: "" | |
| draft: false | |
| generateReleaseNotes: false | |
| makeLatest: false | |
| name: nightly | |
| omitBody: false | |
| omitBodyDuringUpdate: false | |
| omitDraftDuringUpdate: true | |
| omitName: false | |
| omitNameDuringUpdate: true | |
| omitPrereleaseDuringUpdate: true | |
| prerelease: true | |
| removeArtifacts: false | |
| replacesArtifacts: true | |
| skipIfReleaseExists: false | |
| tag: nightly | |
| updateOnlyUnreleased: false | |
| - name: Create Release | |
| if: "${{ github.event.inputs.tag != '' }}" | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.IKEMEN_TOKEN }} | |
| allowUpdates: true | |
| artifactErrorsFailBuild: true | |
| artifacts: "${{ steps.artifacts.outputs.artifact }},${{ steps.artifacts_ffmpeg.outputs.artifact_ffsrc }}" | |
| # body: | | |
| # ${{ needs.tag.outputs.changelog }} | |
| discussionCategory: ${{ github.event.inputs.discussionCategory }} | |
| draft: ${{ github.event.inputs.draft }} | |
| generateReleaseNotes: true | |
| makeLatest: ${{ github.event.inputs.makeLatest }} | |
| name: ${{ needs.tag.outputs.version }} | |
| omitBody: false | |
| omitBodyDuringUpdate: true | |
| omitDraftDuringUpdate: true | |
| omitName: false | |
| omitNameDuringUpdate: true | |
| omitPrereleaseDuringUpdate: true | |
| prerelease: ${{ github.event.inputs.prerelease }} | |
| removeArtifacts: false | |
| replacesArtifacts: true | |
| skipIfReleaseExists: false | |
| tag: ${{ needs.tag.outputs.version }} | |
| updateOnlyUnreleased: false |