Skip to content

Commit

Permalink
Build AppImage on release (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroterzero authored Nov 21, 2023
1 parent 85aa4cc commit 1f180eb
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/check-for-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,31 @@ jobs:
-
name: Get the latest version and unpack
run: bash get-latest.sh
-
name: Build app image
run: bash build-latest-appimage.sh
-
name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: v${{ needs.check_for_update.outputs.NEW_VERSION }}
release_name: Release v${{ needs.check_for_update.outputs.NEW_VERSION }}
draft: false
prerelease: false
-
name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./out/OpenXCOM_Extended-x86_64.AppImage
asset_name: OpenXCOM_Extended-v${{ needs.check_for_update.outputs.NEW_VERSION }}-x86_64.AppImage
asset_content_type: application/octet-stream
-
name: Build the container image
run: bash build-latest.sh
Expand Down
5 changes: 5 additions & 0 deletions AppDir/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

APPIMAGE="$(dirname "$0")"

exec ${APPIMAGE}/usr/bin/OpenXcomEx -data "${APPIMAGE}" -user "$PWD" "$@"
10 changes: 10 additions & 0 deletions AppDir/openxcom.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=OpenXCOM Extended
Comment=Extended version of the OpenXCOM game
Exec=OpenXcomEx
Icon=openxcom
Path=/
Terminal=false
Categories=Game;
Binary file added AppDir/openxcom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions appimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ubuntu:20.04 AS base

# Install dependencies for OXCE and AppImage creation
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libsdl1.2-dev \
libsdl-image1.2-dev \
libsdl-gfx1.2-dev \
libsdl-mixer1.2-dev \
libfuse2 \
appstream \
gnupg2 \
file \
wget \
ca-certificates && \
rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

# Download and prepare AppImage tools (linuxdeploy)
RUN wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O /usr/bin/linuxdeploy && \
chmod +x /usr/bin/linuxdeploy

WORKDIR /app

# COPY build.sh /app
13 changes: 13 additions & 0 deletions build-appimage-in-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

cp -a vol/AppDir .

cp -a vol/oxce/. AppDir/.
rm AppDir/OpenXcomEx

mkdir -p AppDir/usr/bin \
&& cp vol/oxce/OpenXcomEx AppDir/usr/bin/

/usr/bin/linuxdeploy --appdir AppDir --output appimage
mv *.AppImage out/
# bash
24 changes: 24 additions & 0 deletions build-latest-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

LATEST=$(ls -t | grep ^Extended)
if [ "$LATEST" = "" ]; then
echo "Error: could not get latest file"
exit 1
fi

VERSION=$(echo "$LATEST" | cut -d'-' -f2)
if [ "$VERSION" = "" ]; then
echo "Error: could not get latest version number"
exit 1
fi

echo "$VERSION" >> VERSION

docker build -t linuxdeploy appimage
docker run \
--privileged \
--rm \
-v "$PWD:/app/vol":ro \
-v "$PWD/out:/app/out" \
linuxdeploy \
bash -c "vol/build-appimage-in-container.sh"
2 changes: 1 addition & 1 deletion check-for-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ if [ "$LATEST" = "$VERSION" ] && [ "$GITHUB_EVENT_NAME" != "workflow_dispatch" ]
else
echo "Latest version is $LATEST, VERSION file says $VERSION, update available"
echo '::set-output name=DO_UPDATE::1'
echo "::set-output name=NEW_VERSION::$LATEST"
fi

echo "::set-output name=NEW_VERSION::$LATEST"

0 comments on commit 1f180eb

Please sign in to comment.