Skip to content

Commit

Permalink
Merge pull request #611 from cataclysmbnteam/port-github-actions
Browse files Browse the repository at this point in the history
Port DDA's GitHub actions for release
  • Loading branch information
Coolthulhu authored Jun 20, 2021
2 parents e20b1d1 + 2470835 commit 3120389
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 28 deletions.
241 changes: 241 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
name: "Experimental Release"
concurrency: release
on:
push:
branches:
- upload
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/[email protected]
with:
timeZone: 0
format: 'YYYY-MM-DD-HHmm'
- name: Generate environmental variables
id: generate_env_vars
run: |
echo "::set-output name=tag_name::cbn-experimental-${{ steps.get-timestamp.outputs.time }}"
echo "::set-output name=release_name::Cataclysm-BN experimental build ${{ steps.get-timestamp.outputs.time }}"
- name: Check if there is existing git tag
id: tag_check
uses: mukunku/[email protected]
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/[email protected]
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: 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: |
These are the outputs for the experimental build of commit [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
draft: false
prerelease: true
builds:
needs: release
if: ${{ needs.release.outputs.release_already_exists == 'false' }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows Tiles x64
mxe: x86_64
artifact: windows-tiles-x64
os: ubuntu-latest
ext: zip
content: application/zip
- name: Windows Tiles x32
mxe: i686
artifact: windows-tiles-x32
os: ubuntu-latest
ext: zip
content: application/zip
- name: Linux Tiles x64
os: ubuntu-18.04
mxe: none
android: none
tiles: 1
artifact: linux-tiles-x64
ext: tar.gz
content: application/gzip
- name: linux-curses-x64
os: ubuntu-18.04
mxe: none
android: none
tiles: 0
artifact: linux-curses-x64
ext: tar.gz
content: application/gzip
- name: osx-curses-x64
os: macos-10.15
mxe: none
tiles: 0
artifact: osx-curses-x64
ext: dmg
content: application/x-apple-diskimage
- name: osx-tiles-x64
os: macos-10.15
mxe: none
tiles: 1
artifact: osx-tiles-x64
ext: dmg
content: application/x-apple-diskimage
- name: Android x64
os: ubuntu-latest
mxe: none
android: arm64
artifact: android-x64
ext: apk
content: application/apk
- name: Android x32
os: ubuntu-latest
mxe: none
android: arm32
artifact: android-x32
ext: apk
content: application/apk
- name: Android Bundle
os: ubuntu-latest
mxe: none
android: bundle
artifact: android-bundle
ext: aab
content: application/aap
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies (windows)
if: matrix.mxe != 'none'
run: |
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 python ruby scons sed unzip wget xz-utils g++-multilib libc6-dev-i386 libtool-bin
- name: Install MXE
if: matrix.mxe != 'none'
run: |
sudo apt install software-properties-common lsb-release
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9
sudo add-apt-repository "deb [arch=amd64] https://pkg.mxe.cc/repos/apt `lsb_release -sc` main"
sudo apt update
sudo apt install mxe-{i686,x86-64}-w64-mingw32.static-{sdl2,sdl2-ttf,sdl2-image,sdl2-mixer,gettext}
- 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 dmgbuild==1.4.2 biplist
- name: Build CBN (linux)
if: runner.os == 'Linux' && matrix.mxe == 'none' && matrix.android == 'none'
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
make -j$((`nproc`+0)) TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 bindist
mv cataclysmbn.tar.gz cbn-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.tar.gz
- name: Build CBN (windows)
if: matrix.mxe != 'none'
env:
PLATFORM: /usr/lib/mxe/usr/bin/${{ matrix.mxe }}-w64-mingw32.static-
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
make -j$((`nproc`+0)) CROSS="${PLATFORM}" TILES=1 SOUND=1 RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 bindist
mv cataclysmbn.zip cbn-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.zip
- name: Build CBN (osx)
if: runner.os == 'macOS'
env:
USE_HOME_DIR: 1
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
make -j3 TILES=${{ matrix.tiles }} SOUND=${{ matrix.tiles }} RELEASE=1 LOCALIZE=1 LANGUAGES=all BACKTRACE=0 PCH=0 dmgdist
mv CataclysmBN.dmg cbn-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.dmg
- name: Set up JDK 8 (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Setup Build and Dependencies (android)
if: runner.os == 'Linux' && matrix.android != 'none' && matrix.mxe == 'none'
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
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.release.outputs.timestamp }}.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.release.outputs.timestamp }}.apk
elif [ ${{ matrix.android }} = bundle ]
then
./gradlew -Pj=$((`nproc`+0)) bundleExperimentalRelease
mv ./app/build/outputs/bundle/experimentalRelease/*.aab ../cbn-${{ 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: cbn-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.${{ matrix.ext }}
asset_name: cbn-${{ matrix.artifact }}-${{ needs.release.outputs.timestamp }}.${{ matrix.ext }}
asset_content_type: ${{ matrix.content }}
38 changes: 10 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ jobs:

- stage: "Deployable"
# MXE variant using alternate repository http://mirror.mxe.cc/repos/apt
env: COMPILER=g++ LDFLAGS="-static-libgcc -static-libstdc++" MXE_TARGET="i686-w64-mingw32.static" WINE="wine" RELEASE=1 TILES=1 SOUND=1 DEPLOY=1 OPTLEVEL="-O3" BUILD_NAME=win32-tiles
env: COMPILER=g++ LDFLAGS="-static-libgcc -static-libstdc++" MXE_TARGET="i686-w64-mingw32.static" WINE="wine" RELEASE=1 TILES=1 SOUND=1 OPTLEVEL="-O3"
name: "Mingw-w64 Make cross-compile to Windows 32 bit, with -O3 optimization, with Tiles and Sound"
compiler: gcc
addons: &gcc
apt:
packages: ["wine"]

- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1 TILES=1 SOUND=1 DEPLOY=1 BUILD_NAME=lin32-tiles
- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1 TILES=1 SOUND=1
name: "GCC 8 32 bit Make build with Tiles and Sound"
dist: bionic
compiler: gcc
Expand All @@ -79,7 +79,7 @@ jobs:
packages: ["g++-8", "g++-8-multilib", "libc6-dbg", "libc6-dbg:i386", "libsdl2-dev", "libsdl2-ttf-dev", "libsdl2-image-dev", "libsdl2-mixer-dev"]
sources: *apt_sources

- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1 DEPLOY=1 BUILD_NAME=lin32-curses
- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1
name: "GCC 8 32 bit Make build with Curses"
dist: bionic
compiler: gcc
Expand All @@ -89,27 +89,27 @@ jobs:
sources: *apt_sources

# OSX
- env: CLANG=clang++ NATIVE=osx OSX_MIN=10.13 RELEASE=1 TILES=1 SOUND=1 BREWGETTEXT=1 DEPLOY=1 BUILD_NAME=osx32-tiles
- env: CLANG=clang++ NATIVE=osx OSX_MIN=10.13 RELEASE=1 TILES=1 SOUND=1 BREWGETTEXT=1
name: "Xcode 10.1 Make build with Tiles and sound (macOS 32 bit)"
os: osx
osx_image: xcode10.1
compiler: clang

- env: CLANG=clang++ NATIVE=osx OSX_MIN=10.13 RELEASE=1 BREWGETTEXT=1 DEPLOY=1 BUILD_NAME=osx32-curses
- env: CLANG=clang++ NATIVE=osx OSX_MIN=10.13 RELEASE=1 BREWGETTEXT=1
name: "Xcode 10.1 Make build with Curses (macOS 32 bit)"
os: osx
osx_image: xcode10.1
compiler: clang

# 64 bit builds
- env: COMPILER=g++ LDFLAGS="-static-libgcc -static-libstdc++" MXE_TARGET="x86_64-w64-mingw32.static" WINE="wine" RELEASE=1 TILES=1 SOUND=1 DEPLOY=1 OPTLEVEL="-O3" BUILD_NAME=win64-tiles
- env: COMPILER=g++ LDFLAGS="-static-libgcc -static-libstdc++" MXE_TARGET="x86_64-w64-mingw32.static" WINE="wine" RELEASE=1 TILES=1 SOUND=1 OPTLEVEL="-O3"
name: "Mingw-w64 Make cross-compile to Windows 64 bit, with -O3 optimization, with Tiles and Sound"
compiler: gcc
addons: &gcc
apt:
packages: ["wine"]

- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1 TILES=1 SOUND=1 DEPLOY=1 NATIVE=linux64 BUILD_NAME=lin64-tiles
- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1 TILES=1 SOUND=1 NATIVE=linux64
name: "GCC 8 64 bit Make build with Tiles and Sound"
dist: bionic
compiler: gcc
Expand All @@ -118,7 +118,7 @@ jobs:
packages: ["g++-8", "g++-8-multilib", "libc6-dbg", "libsdl2-dev", "libsdl2-ttf-dev", "libsdl2-image-dev", "libsdl2-mixer-dev"]
sources: *apt_sources

- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1 DEPLOY=1 NATIVE=linux64 BUILD_NAME=lin64-curses
- env: COMPILER=g++-8 CXXFLAGS="-Wno-implicit-fallthrough" RELEASE=1 NATIVE=linux64
name: "GCC 8 64 bit Make build with Curses"
dist: bionic
compiler: gcc
Expand All @@ -128,7 +128,7 @@ jobs:
sources: *apt_sources

# Android
- env: NATIVE=android BUILD_NAME=android64 DEPLOY=1
- env: NATIVE=android
name: "Android ARM 64"
language: android
dist: trusty
Expand All @@ -138,7 +138,7 @@ jobs:
- android-16
- platform-tools

- env: NATIVE=android BUILD_NAME=android32 DEPLOY=1 ANDROID32=1
- env: NATIVE=android ANDROID32=1
name: "Android ARM 32"
language: android
dist: trusty
Expand Down Expand Up @@ -254,21 +254,3 @@ script:
after_success:
- if [ -n "${CODE_COVERAGE}" ]; then coveralls -b . -i src -e tests --gcov /usr/bin/gcov-6; fi
- if [ -n "${CODE_COVERAGE}" ]; then bash <(curl -s https://codecov.io/bash); fi

before_deploy:
- export TRAVIS_TAG=${TRAVIS_BUILD_NUMBER}
- git tag --force $TRAVIS_TAG
- export RELEASE_PKG_FILES=$(ls cataclysm*.zip cataclysm*.tar.gz Cataclysm*.dmg)
- if [ $NATIVE == "android" ]; then RELEASE_PKG_FILES=$(find android -name "*.apk"); fi

deploy:
provider: releases
api_key:
secure: YkZwEzn5TJI6fdqiYNUdWp4FaIQxvGgznW6YduSEGiiOawJOWrGqk10NGKCuOicOBI32h7ivoEIuPWc1pvABgY45WgFxI8XprBtt67sNvu//cF8GGJztevdVKbuMFa7ENRF3AuQU/OI1ll2kN5WFz+mQwfXI3Cp1kRNqUt26i8Xf7TWuXthjPob9oitlIEdq2P80Q3d6+SM8Mu2qyYF6TqUY45UMsxIFaf0HpJqgqrDZYF4iOKAoK1GihpgBYZb/VEkQWMR9yV/YOsSMDVhFXCr32tcjkxz9wY1azr6RdRK15xO/uJa8/j00a8E4rWZ/NIL3p2ZHGGXSrgDM12d1AY0nYs4Hr4VqtGv6jSemg/k9fml/7KHRa04oTv74ncUS1YYyVggQqGYd/Odekkj7yewOINUWNeZfMgsqYUgX1rlGiIxP5lkoMPwQRkFVo31k/eQ6SwrprYpi0QZWayy56LdhKZELiiuba6C5lWu5/39+hjxxsRonEwupCnuh6dGIEzhDhIEu7H2JRfqh1mxU8nOWSKac9PkOeQRBERAxiidBjIccDLVfwkxpeUSdXgrMXJ3VKNvdCOJmiA3ExHTvOCNfxMk6TfOLwjkpOOB+DqnN9G7STMjKZfO505W0QPWKHGFNbfD+g/qd4rTY7Fk+j5eDK+3WDeeEcl06vZmmij0=
file_glob: true
file: ${RELEASE_PKG_FILES}
skip_cleanup: true
on:
repo: cataclysmbnteam/Cataclysm-BN
branch: upload
condition: $ENABLE_DEPLOY = '1' && $DEPLOY = '1'
Binary file removed android/app/bn-release.keystore.enc
Binary file not shown.
Binary file removed android/keystore.properties.enc
Binary file not shown.

0 comments on commit 3120389

Please sign in to comment.