Manual release #35
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
| name: "Manual release" | |
| concurrency: release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| major: | |
| { description: SemVer major, required: true, type: number, default: 0 } | |
| minor: { description: SemVer minor, required: true, type: number } | |
| patch: | |
| { description: SemVer patch, required: true, type: number, default: 0 } | |
| env: | |
| VERSION: "v${{ inputs.major }}.${{ inputs.minor }}.${{ inputs.patch }}" | |
| VCPKG_BINARY_SOURCES: "default" | |
| jobs: | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Create release | |
| run: | | |
| set +e | |
| gh release view ${{ env.VERSION }} --json name --jq '.name' | |
| HAS_NO_RELEASE=$? # error == exitcode 1 == no release of given version exists | |
| if (( $HAS_NO_RELEASE == 0 )); then | |
| echo "Release already exists, skipping." >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "Release does not exist, creating a new one" >> "$GITHUB_STEP_SUMMARY" | |
| gh release create ${{ env.VERSION }} \ | |
| --title "Cataclysm-BN ${{ env.VERSION }}" \ | |
| --draft \ | |
| --prerelease \ | |
| --generate-notes \ | |
| --target ${{ github.sha }} | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| builds: | |
| needs: release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Windows Tiles x64 MSVC | |
| artifact: windows-tiles-x64-msvc | |
| arch: x64 | |
| os: windows-latest | |
| ext: zip | |
| content: application/zip | |
| - name: Linux Tiles x64 | |
| os: ubuntu-latest | |
| android: none | |
| tiles: 1 | |
| artifact: linux-tiles-x64 | |
| ext: tar.gz | |
| content: application/gzip | |
| - name: linux-curses-x64 | |
| os: ubuntu-latest | |
| android: none | |
| tiles: 0 | |
| artifact: linux-curses-x64 | |
| ext: tar.gz | |
| content: application/gzip | |
| - name: osx-curses-x64 | |
| os: macos-15-intel | |
| tiles: 0 | |
| artifact: osx-curses-x64 | |
| ext: dmg | |
| content: application/x-apple-diskimage | |
| - name: osx-tiles-x64 | |
| os: macos-15-intel | |
| tiles: 1 | |
| artifact: osx-tiles-x64 | |
| ext: dmg | |
| content: application/x-apple-diskimage | |
| - name: osx-curses-arm | |
| os: macos-15 | |
| tiles: 0 | |
| artifact: osx-curses-arm | |
| ext: dmg | |
| content: application/x-apple-diskimage | |
| - name: osx-tiles-arm | |
| os: macos-15 | |
| tiles: 1 | |
| artifact: osx-tiles-arm | |
| ext: dmg | |
| content: application/x-apple-diskimage | |
| - name: Android x64 | |
| os: ubuntu-latest | |
| android: arm64 | |
| artifact: android-x64 | |
| ext: apk | |
| content: application/apk | |
| - name: Android Bundle | |
| os: ubuntu-latest | |
| android: bundle | |
| artifact: android-bundle | |
| ext: aab | |
| content: application/aap | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| ZSTD_CLEVEL: 17 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create VERSION.TXT | |
| shell: bash | |
| run: | | |
| cat >VERSION.txt <<EOL | |
| build type: ${{ matrix.artifact }} | |
| build version string: ${{ env.VERSION }} | |
| commit sha: ${{ github.sha }} | |
| commit url: https://github.com/${{ github.repository }}/commit/${{ github.sha }} | |
| EOL | |
| - name: Setup msys2 (windows msvc) | |
| if: runner.os == 'Windows' | |
| uses: msys2/setup-msys2@v2 | |
| with: { msystem: mingw64, install: gettext } | |
| - name: Compile translations (windows msvc) | |
| if: runner.os == 'Windows' | |
| shell: msys2 {0} | |
| run: lang/compile_mo.sh all | |
| - name: Install dependencies (windows msvc) (1/3) | |
| if: runner.os == 'Windows' | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| vs-version: 17.13 | |
| - name: Install dependencies (windows msvc) (2/3) | |
| if: runner.os == 'Windows' | |
| uses: lukka/run-vcpkg@main | |
| id: runvcpkg | |
| with: | |
| vcpkgDirectory: "${{ runner.workspace }}/b/vcpkg" | |
| - name: Install dependencies (windows msvc) (3/3) | |
| if: runner.os == 'Windows' | |
| run: | | |
| vcpkg integrate install | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' && matrix.android == 'none' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install gcc-14 libncursesw5-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev \ | |
| libsdl2-mixer-dev libpulse-dev ccache gettext parallel libsqlite3-dev zlib1g-dev | |
| sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 | |
| g++ --version | |
| - name: Install runtime dependencies (mac) | |
| if: runner.os == 'macOS' | |
| uses: BrettDong/setup-sdl2-frameworks@v1 | |
| with: | |
| sdl2: 2.30.11 | |
| sdl2-ttf: 2.24.0 | |
| sdl2-image: 2.8.4 | |
| sdl2-mixer: 2.8.0 | |
| - name: Install build dependencies (mac) | |
| if: runner.os == 'macOS' | |
| run: | | |
| HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install gettext ccache parallel llvm@20 astyle sqlite3 zlib | |
| python3 -m venv ./venv | |
| source ./venv/bin/activate | |
| pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist polib luaparser | |
| - name: Build CBN (linux) | |
| if: runner.os == 'Linux' && matrix.android == 'none' | |
| run: | | |
| make -j$((`nproc`+0)) TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LANGUAGES=all PCH=0 bindist | |
| mv cataclysmbn-${{ env.VERSION }}.tar.gz cbn-${{ matrix.artifact }}-${{ env.VERSION }}.tar.gz | |
| - name: Build CBN (windows msvc) | |
| if: runner.os == 'Windows' | |
| env: | |
| VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}\.github\vcpkg_triplets | |
| run: | | |
| msbuild -m -p:Configuration=Release -p:Platform=${{ matrix.arch }} "-target:Cataclysm-vcpkg-static;JsonFormatter-vcpkg-static" msvc-full-features\Cataclysm-vcpkg-static.sln | |
| .\build-scripts\windist.ps1 | |
| mv cataclysmbn.zip cbn-${{ matrix.artifact }}-${{ env.VERSION }}.zip | |
| - name: Build CBN (osx) | |
| if: runner.os == 'macOS' | |
| run: | | |
| source ./venv/bin/activate | |
| make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 OSX_MIN=11 FRAMEWORK=1 COMPILER=$(brew --prefix llvm@20)/bin/clang++ dmgdist | |
| mv CataclysmBN-${{ env.VERSION }}.dmg cbn-${{ matrix.artifact }}-${{ env.VERSION }}.dmg | |
| - name: Set up JDK 11 (android) | |
| if: runner.os == 'Linux' && matrix.android != 'none' | |
| uses: actions/setup-java@v4.1.0 | |
| with: | |
| java-version: "11" | |
| distribution: "adopt" | |
| - name: Setup Build and Dependencies (android) | |
| if: runner.os == 'Linux' && matrix.android != 'none' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install gettext | |
| - name: Build CBN (android) | |
| if: runner.os == 'Linux' && matrix.android != 'none' | |
| working-directory: ./android | |
| run: | | |
| echo "${{ secrets.KEYSTORE }}" > release.keystore.asc | |
| gpg -d --passphrase "${{ secrets.KEYSTORE_PASSWORD }}" --batch release.keystore.asc > app/release.keystore | |
| echo "${{ secrets.KEYSTORE_PROPERTIES }}" > keystore.properties.asc | |
| gpg -d --passphrase "${{ secrets.KEYSTORE_PASSWORD }}" --batch keystore.properties.asc > keystore.properties | |
| chmod +x gradlew | |
| if [ ${{ matrix.android }} = arm64 ] | |
| then | |
| ./gradlew -Pj=$((`nproc`+0)) -Pabi_arm_32=false assembleStableRelease -Poverride_version=${{ env.VERSION }} | |
| mv ./app/build/outputs/apk/stable/release/*.apk ../cbn-${{ matrix.artifact }}-${{ env.VERSION }}.apk | |
| elif [ ${{ matrix.android }} = arm32 ] | |
| then | |
| ./gradlew -Pj=$((`nproc`+0)) -Pabi_arm_64=false assembleStableRelease -Poverride_version=${{ env.VERSION }} | |
| mv ./app/build/outputs/apk/stable/release/*.apk ../cbn-${{ matrix.artifact }}-${{ env.VERSION }}.apk | |
| elif [ ${{ matrix.android }} = bundle ] | |
| then | |
| ./gradlew -Pj=$((`nproc`+0)) bundleStableRelease -Poverride_version=${{ env.VERSION }} | |
| mv ./app/build/outputs/bundle/stableRelease/*.aab ../cbn-${{ matrix.artifact }}-${{ env.VERSION }}.aab | |
| fi | |
| - name: Upload release asset | |
| run: | | |
| gh release upload ${{ env.VERSION }} --clobber cbn-${{ matrix.artifact }}-${{ env.VERSION }}.${{ matrix.ext }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash |