Nightly Release #589
This file contains 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: "Nightly Release" | |
concurrency: release | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
env: | |
VCPKG_BINARY_SOURCES: "default" | |
jobs: | |
metadata: | |
runs-on: ubuntu-latest | |
outputs: | |
count: ${{ steps.env_vars.outputs.count }} | |
tag_name: ${{ steps.env_vars.outputs.tag_name }} | |
release_name: ${{ steps.env_vars.outputs.release_name }} | |
last_tag_name: ${{ steps.env_vars.outputs.last_tag_name }} | |
yesterday_tag_name: ${{ steps.env_vars.outputs.yesterday_tag_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: env_vars | |
run: | | |
TAG_NAME=$(date -u --iso-8601 --date='1 day ago') | |
YESTERDAY_TAG_NAME=$(date -u --iso-8601 --date='2 day ago') | |
LAST_TAG_NAME=$(git for-each-ref --sort=-creatordate --format '%(creatordate:short)' refs/tags | head -n 1) | |
COMMITS=$(git log --oneline --since="$TAG_NAME" | wc -l) | |
RELEASE_NAME="Nightly $TAG_NAME" | |
echo "commits yesterday ($TAG_NAME): $COMMITS" >> "$GITHUB_STEP_SUMMARY" | |
echo "count=$COMMITS" >> "$GITHUB_OUTPUT" | |
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT" | |
echo "last_tag_name=$LAST_TAG_NAME" >> "$GITHUB_OUTPUT" | |
echo "yesterday_tag_name=$YESTERDAY_TAG_NAME" >> "$GITHUB_OUTPUT" | |
echo "release_name=$RELEASE_NAME" >> "$GITHUB_OUTPUT" | |
release: | |
needs: metadata | |
name: Create Release | |
runs-on: ubuntu-24.04 | |
if: github.event_name == 'workflow_dispatch' || fromJson(needs.metadata.outputs.count) > 0 | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
release_already_exists: ${{ steps.tag_check.outputs.exists }} | |
steps: | |
- name: Check if there is existing git tag | |
id: tag_check | |
uses: mukunku/tag-exists-action@v1.6.0 | |
with: | |
tag: ${{ needs.metadata.outputs.tag_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
- name: Push tag | |
if: ${{ steps.tag_check.outputs.exists == 'false' }} | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ needs.metadata.outputs.tag_name }} | |
tag_prefix: "" | |
- name: Build Changelog | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@v4.2.0 | |
with: | |
configuration: "changelog.json" | |
fromTag: ${{ needs.metadata.outputs.last_tag_name }} | |
toTag: ${{ needs.metadata.outputs.tag_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
id: create_release | |
uses: softprops/action-gh-release@v2.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.metadata.outputs.tag_name }} | |
name: ${{ needs.metadata.outputs.release_name }} | |
body: | | |
${{ steps.build_changelog.outputs.changelog }} | |
These are the outputs for the build of commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) | |
draft: false | |
prerelease: true | |
builds: | |
needs: [metadata, release] | |
if: ${{ needs.release.outputs.release_already_exists == 'false' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Windows Tiles x64 MSVC | |
artifact: windows-tiles-x64-msvc | |
arch: x64 | |
os: windows-2019 | |
mxe: none | |
ext: zip | |
content: application/zip | |
- name: Windows Tiles x32 MSVC | |
artifact: windows-tiles-x32-msvc | |
arch: x86 | |
os: windows-2019 | |
mxe: none | |
ext: zip | |
content: application/zip | |
- name: Windows Tiles x64 | |
mxe: x86_64 | |
mxe_apt: x86-64 | |
artifact: windows-tiles-x64 | |
os: ubuntu-24.04 | |
ext: zip | |
content: application/zip | |
- name: Windows Tiles x32 | |
mxe: i686 | |
mxe_apt: i686 | |
artifact: windows-tiles-x32 | |
os: ubuntu-24.04 | |
ext: zip | |
content: application/zip | |
- name: Linux Tiles x64 | |
os: ubuntu-24.04 | |
mxe: none | |
android: none | |
tiles: 1 | |
artifact: linux-tiles-x64 | |
ext: tar.gz | |
content: application/gzip | |
- name: linux-curses-x64 | |
os: ubuntu-24.04 | |
mxe: none | |
android: none | |
tiles: 0 | |
artifact: linux-curses-x64 | |
ext: tar.gz | |
content: application/gzip | |
- name: osx-curses-x64 | |
os: macos-12 | |
mxe: none | |
tiles: 0 | |
artifact: osx-curses-x64 | |
ext: dmg | |
content: application/x-apple-diskimage | |
- name: osx-tiles-x64 | |
os: macos-12 | |
mxe: none | |
tiles: 1 | |
artifact: osx-tiles-x64 | |
ext: dmg | |
content: application/x-apple-diskimage | |
- name: osx-curses-arm | |
os: macos-14 | |
mxe: none | |
tiles: 0 | |
artifact: osx-curses-arm | |
ext: dmg | |
content: application/x-apple-diskimage | |
- name: osx-tiles-arm | |
os: macos-14 | |
mxe: none | |
tiles: 1 | |
artifact: osx-tiles-arm | |
ext: dmg | |
content: application/x-apple-diskimage | |
- name: Android x64 | |
os: ubuntu-24.04 | |
mxe: none | |
android: arm64 | |
artifact: android-x64 | |
ext: apk | |
content: application/apk | |
- name: Android x32 | |
os: ubuntu-24.04 | |
mxe: none | |
android: arm32 | |
artifact: android-x32 | |
ext: apk | |
content: application/apk | |
- name: Android Bundle | |
os: ubuntu-24.04 | |
mxe: none | |
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 number: ${{ needs.metadata.outputs.tag_name }} | |
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 MSBuild (windows msvc) | |
if: runner.os == 'Windows' | |
uses: microsoft/setup-msbuild@v1.3.1 | |
- name: Install stable CMake | |
uses: lukka/get-cmake@latest | |
- name: Install vcpkg | |
uses: lukka/run-vcpkg@v11 | |
id: runvcpkg | |
with: | |
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' | |
vcpkgGitCommitId: "66444e13a86da7087ee24c342f91801cc6eb9877" | |
- name: Integrate vcpkg | |
if: runner.os == 'Windows' | |
run: | | |
vcpkg integrate install | |
- name: Install dependencies (windows mxe) | |
if: matrix.mxe != 'none' | |
run: | | |
sudo apt update | |
sudo apt install astyle autoconf automake autopoint bash bison bzip2 cmake flex gettext git g++ gperf intltool \ | |
libffi-dev libgdk-pixbuf2.0-dev libtool libltdl-dev libssl-dev libxml-parser-perl lzip make mingw-w64 openssl \ | |
p7zip-full patch perl pkg-config python3 ruby scons sed unzip wget xz-utils g++-multilib libc6-dev-i386 libtool-bin | |
- name: Install MXE | |
if: matrix.mxe != 'none' | |
run: | | |
curl -L -o mxe-${{ matrix.mxe }}.tar.xz https://github.com/BrettDong/MXE-GCC/releases/download/mxe-sdl-2-0-20/mxe-${{ matrix.mxe }}.tar.xz | |
curl -L -o mxe-${{ matrix.mxe }}.tar.xz.sha256 https://github.com/BrettDong/MXE-GCC/releases/download/mxe-sdl-2-0-20/mxe-${{ matrix.mxe }}.tar.xz.sha256 | |
shasum -a 256 -c ./mxe-${{ matrix.mxe }}.tar.xz.sha256 | |
sudo tar xJf mxe-${{ matrix.mxe }}.tar.xz -C /opt | |
curl -L -o SDL2-devel-2.26.2-mingw.tar.gz https://github.com/libsdl-org/SDL/releases/download/release-2.26.2/SDL2-devel-2.26.2-mingw.tar.gz | |
shasum -a 256 -c ./build-scripts/SDL2-devel-2.26.2-mingw.tar.gz.sha256 | |
sudo tar -xzf SDL2-devel-2.26.2-mingw.tar.gz -C /opt/mxe/usr/${{ matrix.mxe }}-w64-mingw32.static.gcc12 --strip-components=2 SDL2-2.26.2/${{ matrix.mxe }}-w64-mingw32 | |
curl -L -o libbacktrace-${{ matrix.mxe }}-w64-mingw32.tar.gz https://github.com/Qrox/libbacktrace/releases/download/2020-01-03/libbacktrace-${{ matrix.mxe }}-w64-mingw32.tar.gz | |
shasum -a 256 -c ./build-scripts/libbacktrace-${{ matrix.mxe }}-w64-mingw32-sha256 | |
sudo tar -xzf libbacktrace-${{ matrix.mxe }}-w64-mingw32.tar.gz --exclude=LICENSE -C /opt/mxe/usr/${{ matrix.mxe }}-w64-mingw32.static.gcc12 | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libncursesw5-dev libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev \ | |
libsdl2-mixer-dev libpulse-dev ccache gettext parallel | |
- name: Install runtime dependencies (mac) | |
if: runner.os == 'macOS' | |
uses: BrettDong/setup-sdl2-frameworks@v1 | |
with: | |
sdl2: latest | |
sdl2-ttf: latest | |
sdl2-image: latest | |
sdl2-mixer: latest | |
- 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 | |
python3 -m venv ./venv | |
source ./venv/bin/activate | |
pip3 install mac_alias==2.2.0 dmgbuild==1.6.1 biplist | |
- name: Build CBN (linux) | |
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none' | |
run: | | |
make -j$((`nproc`+0)) TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} LUA=1 RELEASE=1 LANGUAGES=all PCH=0 bindist | |
mv cataclysmbn-unstable.tar.gz cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.tar.gz | |
- name: Build CBN (windows) | |
if: matrix.mxe != 'none' | |
env: | |
PLATFORM: /opt/mxe/usr/bin/${{ matrix.mxe }}-w64-mingw32.static.gcc12- | |
run: | | |
make -j$((`nproc`+0)) CROSS="${PLATFORM}" TILES=1 SOUND=1 LUA=1 RELEASE=1 LANGUAGES=all PCH=0 bindist | |
mv cataclysmbn-unstable.zip cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.zip | |
- 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 }}-${{ needs.metadata.outputs.tag_name }}.zip | |
- name: Build CBN (osx) | |
if: runner.os == 'macOS' | |
run: | | |
source ./venv/bin/activate | |
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LUA=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 OSX_MIN=11 FRAMEWORK=1 dmgdist | |
mv CataclysmBN-unstable.dmg cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.dmg | |
- name: Set up JDK 11 (android) | |
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == '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' && matrix.mxe == 'none' | |
run: | | |
sudo apt-get update | |
sudo apt-get install gettext | |
- name: Build CBN (android) | |
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == '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 | |
export UPSTREAM_BUILD_NUMBER="$((2037 + ${{ github.run_number }}))" | |
chmod +x gradlew | |
if [ ${{ matrix.android }} = arm64 ] | |
then | |
./gradlew -Pj=$((`nproc`+0)) -Pabi_arm_32=false assembleExperimentalRelease | |
mv ./app/build/outputs/apk/experimental/release/*.apk ../cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.apk | |
elif [ ${{ matrix.android }} = arm32 ] | |
then | |
./gradlew -Pj=$((`nproc`+0)) -Pabi_arm_64=false assembleExperimentalRelease | |
mv ./app/build/outputs/apk/experimental/release/*.apk ../cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.apk | |
elif [ ${{ matrix.android }} = bundle ] | |
then | |
./gradlew -Pj=$((`nproc`+0)) bundleExperimentalRelease | |
mv ./app/build/outputs/bundle/experimentalRelease/*.aab ../cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.aab | |
fi | |
- name: Upload release asset | |
id: upload-release-asset | |
uses: shogo82148/actions-upload-release-asset@v1.7.4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.${{ matrix.ext }} | |
asset_name: cbn-${{ matrix.artifact }}-${{ needs.metadata.outputs.tag_name }}.${{ matrix.ext }} | |
asset_content_type: ${{ matrix.content }} |