From c9003dd867e18bd9925b9a924f123ed1318a114a Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 09:18:29 +0100 Subject: [PATCH] add github action to build appimage --- .github/workflows/appimage.yml | 42 ++++++++++++++++++++++++++++++++++ tools/build_appimage.sh | 37 +++++++++++++++--------------- 2 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/appimage.yml diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml new file mode 100644 index 000000000..77a434832 --- /dev/null +++ b/.github/workflows/appimage.yml @@ -0,0 +1,42 @@ +name: AppImage Continuous + +on: + push: + branches: + - master + workflow_dispatch: + +env: + BUILD_TYPE: RelWithDebInfo + +jobs: + linux-appimage-continuous: + strategy: + matrix: + game: [{id: wargus, name: Wargus}, {id: war1gus, name: War1gus}] + name: Linux x64_64 (Continuous) + runs-on: ubuntu-18.04 + steps: + - name: Build game ${{ matrix.game.id }} + run: bash -x ./tools/build_appimage.sh ${{ matrix.game.id }} ${{ matrix.game.name }} + - name: Build appimage + uses: AppImageCrafters/build-appimage@master + with: + recipe: "./appimagebuilder.yaml" + - name: Create continuous release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "*.AppImage*" + body: | + :heavy_check_mark: AppImage built from latest commit ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})). + :scroll: Build log: https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks?check_suite_id=${{ github.run_id }} + commit: ${{ github.sha }} + draft: false + name: Continuous appimage builds + prerelease: true + removeArtifacts: false + replacesArtifacts: true + skipIfReleaseExists: false + tag: continuous + token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index ffc29f2dc..ed216fe64 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -26,8 +26,7 @@ if [ -z "$GAME_VERSION" ]; then if [ $# -gt 2 ]; then export GAME_VERSION="$3" else - echo "Need GAME_VERSION set or passed as third argument" - exit 1 + export GAME_VERSION="$(head -1 debian/changelog | cut -f2 -d' ' | sed 's/(//' | sed 's/)//')" fi fi export GAME_ARCH=$(uname -m) @@ -64,10 +63,10 @@ pushd cmake-3.* make install popd -git clone --depth 1 https://github.com/Wargus/stratagus +# git clone --depth 1 https://github.com/Wargus/stratagus git clone --depth 1 https://github.com/Wargus/${GAME_ID} -pushd stratagus +# pushd stratagus git submodule update --init --recursive mkdir build pushd build @@ -80,7 +79,7 @@ pushd stratagus -DGAMEDIR=/usr/bin make -j install DESTDIR=../../AppDir popd - popd +# popd pushd ${GAME_ID} git submodule update --init --recursive mkdir build @@ -114,17 +113,19 @@ if [ -n "$CENTOS" ]; then ./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir AppDir --output appimage else # using appimage-builder - echo "version: 1" > appimagebuilder.yaml - echo "AppDir:" >> appimagebuilder.yaml - echo " path: ./AppDir" >> appimagebuilder.yaml - echo " app_info:" >> appimagebuilder.yaml - echo " id: com.stratagus.{{GAME_ID}}" >> appimagebuilder.yaml - echo " name: '{{GAME_NAME}}'" >> appimagebuilder.yaml - echo " icon: '{{GAME_ID}}'" >> appimagebuilder.yaml - echo " version: '{{GAME_VERSION}}'" >> appimagebuilder.yaml - echo " exec: usr/bin/{{GAME_ID}}" >> appimagebuilder.yaml - echo ' exec_args: --argv0=${APPDIR}/usr/bin/{{GAME_ID}} $@' >> appimagebuilder.yaml - echo "AppImage:" >> appimagebuilder.yaml - echo " arch: '{{GAME_ARCH}}'" >> appimagebuilder.yaml - appimage-builder --recipe appimagebuilder.yaml + echo "version: 1" > appimagebuilder.yaml + echo "AppDir:" >> appimagebuilder.yaml + echo " path: ./AppDir" >> appimagebuilder.yaml + echo " app_info:" >> appimagebuilder.yaml + echo " id: com.stratagus.${GAME_ID}" >> appimagebuilder.yaml + echo " name: '${GAME_NAME}'" >> appimagebuilder.yaml + echo " icon: '${GAME_ID}'" >> appimagebuilder.yaml + echo " version: '${GAME_VERSION}'" >> appimagebuilder.yaml + echo " exec: usr/bin/${GAME_ID}" >> appimagebuilder.yaml + echo -n ' exec_args: --argv0=${APPDIR}/usr/bin/' >> appimagebuilder.yaml + echo -n "${GAME_ID} " >> appimagebuilder.yaml + echo '$@' >> appimagebuilder.yaml + echo "AppImage:" >> appimagebuilder.yaml + echo " arch: '${GAME_ARCH}'" >> appimagebuilder.yaml + appimage-builder --recipe appimagebuilder.yaml || true # in github, we run this after fi