Skip to content

Experimental Release #279

Experimental Release

Experimental Release #279

Workflow file for this run

name: "Experimental Release"
concurrency: release
on:
workflow_dispatch:
push:
branches:
- "no"
paths:
- '.github/workflows/release.yml'
- 'android/**'
- 'build-data/**'
- 'cataclysm-launcher'
- 'data/**'
- 'doc/**'
- 'gfx/**'
- 'lang/po/*.po'
- 'LICENSE*'
- 'Makefile'
- 'README*'
- 'src/**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
timestamp: ${{ steps.get-timestamp.outputs.time }}
release_already_exists: ${{ steps.tag_check.outputs.exists }}
steps:
- name: Get build timestamp
id: get-timestamp
uses: nanzm/get-time-action@v1.1
with:
timeZone: 0
format: 'YYYY-MM-DD-HHmm'
- name: Generate environmental variables
id: generate_env_vars
run: |
echo "tag_name=cdda-breeze-${{ steps.get-timestamp.outputs.time }}" >> $GITHUB_OUTPUT
echo "release_name=CDDA-Breeze ${{ steps.get-timestamp.outputs.time }}" >> $GITHUB_OUTPUT
- name: Check if there is existing git tag
id: tag_check
uses: mukunku/tag-exists-action@v1.0.0
with:
tag: ${{ steps.generate_env_vars.outputs.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- name: Push tag
id: tag_version
uses: mathieudutour/github-tag-action@v5.5
if: ${{ steps.tag_check.outputs.exists == 'false' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.generate_env_vars.outputs.tag_name }}
tag_prefix: ""
- name: "Generate release notes"
run: |
gh api \
--method POST \
-H "Accept: application/vnd.github.v3+json" \
/repos/WhiteCloud0123/CDDA-Breeze/releases/generate-notes \
-f tag_name='${{ steps.generate_env_vars.outputs.tag_name }}' \
-f target_commitish='main' \
-q .body > CHANGELOG.md
- name: Create release
id: create_release
uses: actions/create-release@v1
if: ${{ steps.tag_check.outputs.exists == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.generate_env_vars.outputs.tag_name }}
release_name: ${{ steps.generate_env_vars.outputs.release_name }}
body_path: ./CHANGELOG.md
draft: false
prerelease: false
builds:
needs: 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: Android x64
os: ubuntu-latest
mxe: none
android: arm64
artifact: android-x64
ext: apk
content: application/apk
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
env:
ZSTD_CLEVEL: 17
steps:
- uses: actions/checkout@v2
- name: Get soundpack
if: matrix.sound == 1
run: |
git clone --depth=1 --shallow-submodules --recurse-submodules https://github.com/Fris0uman/CDDA-Soundpacks '${{ github.workspace }}/CDDA-Soundpacks'
mv '${{ github.workspace }}/CDDA-Soundpacks/sound/CC-Sounds' '${{ github.workspace }}/data/sound'
- name: Install dependencies (windows msvc) (0/4)
if: runner.os == 'Windows'
uses: lukka/get-cmake@latest
- name: Install dependencies (windows msvc) (1/4)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v1.0.2
- name: Install dependencies (windows msvc) (2/4)
if: runner.os == 'Windows'
uses: lukka/run-vcpkg@v11
id: runvcpkg
with:
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
# We have to use at least this version of vcpkg to include fixes for yasm-tool's
# availability only as an x86 host tool. Keep it in sync with the builtin-baseline
# field in vcpkg.json. Caching happens as a post-action which runs at the end of
# the whole workflow, after vcpkg install happens during msbuild run.
vcpkgGitCommitId: "66444e13a86da7087ee24c342f91801cc6eb9877"
- name: Install dependencies (windows msvc) (3/4)
if: runner.os == 'Windows'
run: |
vcpkg integrate install --vcpkg-root '${{ runner.workspace }}\b\vcpkg'
- name: Install dependencies (windows msvc) (4/4)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
install: >-
gettext
make
- name: Install dependencies (windows mxe)
if: matrix.mxe != 'none'
run: |
sudo apt install gettext
- 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-gcc-11.2/mxe-${{ matrix.mxe }}.tar.xz
curl -L -o mxe-${{ matrix.mxe }}.tar.xz.sha256 https://github.com/BrettDong/MXE-GCC/releases/download/mxe-gcc-11.2/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 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.gcc11
- 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 dependencies (mac)
if: runner.os == 'macOS'
run: |
HOMEBREW_NO_AUTO_UPDATE=yes HOMEBREW_NO_INSTALL_CLEANUP=yes brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gettext ccache parallel
pip3 install mac_alias==2.2.0 dmgbuild==1.4.2 biplist
- name: Create VERSION.TXT
shell: bash
run: |
cat >VERSION.txt <<EOL
build type: ${{ matrix.artifact }}
build number: ${{ needs.release.outputs.timestamp }}
commit sha: ${{ github.sha }}
commit url: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
EOL
- name: Compile translations (windows)
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
lang/compile_mo.sh all
- name: Build CDDA (linux)
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none'
run: |
make -j$((`nproc`+0)) TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 bindist
mv cataclysmdda-0.G.tar.gz cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.tar.gz
- name: Build CDDA (windows mxe)
if: matrix.mxe != 'none'
env:
PLATFORM: /opt/mxe/usr/bin/${{ matrix.mxe }}-w64-mingw32.static.gcc11-
run: |
make -j$((`nproc`+0)) CROSS="${PLATFORM}" TILES=1 SOUND=1 RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=1 PCH=0 bindist
mv cataclysmdda-0.G.zip CDDA-Breeze-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.zip
- name: Build CDDA (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 cataclysmdda-0.G.zip CDDA-Breeze-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.zip
- name: Build CDDA (osx)
if: runner.os == 'macOS'
run: |
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 USE_HOME_DIR=1 OSX_MIN=10.12 dmgdist
mv Cataclysm.dmg cdda-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.dmg
- name: Set up JDK 11 (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
uses: actions/setup-java@v2
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 CDDA (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
working-directory: ./android
run: |
cp -r ${{ github.workspace }}/data ${{ github.workspace }}/android/app/src/main/assets
cp -r ${{ github.workspace }}/gfx ${{ github.workspace }}/android/app/src/main/assets
echo -e "keyPassword=${{ secrets.KEY_01 }}\nkeyAlias=a\nstorePassword=123456\nstoreFile=${{ github.workspace }}/android/a.keystore" > keystore.properties
export UPSTREAM_BUILD_NUMBER="$((11581 + ${{ github.run_number }}))"
chmod +x gradlew
if [ ${{ matrix.android }} = arm64 ]
then
./gradlew -Pj=$((`nproc`+0)) -Pabi_arm_32=false assembleRelease
mv ./app/build/outputs/apk/stable/release/*.apk ../CDDA-Breeze-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.apk
elif [ ${{ matrix.android }} = arm32 ]
then
./gradlew -Pj=$((`nproc`+0)) -Pabi_arm_64=false assembleRelease
mv ./app/build/outputs/apk/stable/release/*.apk ../CDDA-Breeze-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.apk
elif [ ${{ matrix.android }} = bundle ]
then
./gradlew -Pj=$((`nproc`+0)) bundleExperimentalRelease
mv ./app/build/outputs/bundle/experimentalRelease/*.aab ../CDDA-Breeze-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.aab
fi
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: CDDA-Breeze-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.${{ matrix.ext }}
asset_name: CDDA-Breeze-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.${{ matrix.ext }}
asset_content_type: ${{ matrix.content }}