removing file #426
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: Build For Linux GNU x86_64 as AppImage | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish engine' | |
required: true | |
default: 'no' | |
type: choice | |
options: | |
- 'no' | |
- 'yes' | |
jobs: | |
build: | |
if: (!endsWith(github.event.head_commit.message, '--norun')) | |
runs-on: ubuntu-20.04 # Intentionally set so it uses an older GLIBC | |
environment: Linux | |
env: | |
CARGO_TERM_COLOR: always | |
WORKSPACE: ${{ github.workspace }} | |
RUST_BACKTRACE: full | |
APPIMAGE_FILENAME: catgirl-engine-x86_64.AppImage | |
steps: | |
# Setup Build Environment | |
- name: 🎉 The job was automatically triggered by a ${{ github.event_name }} event. | |
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- name: 🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub! | |
run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- name: 🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}. | |
run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
submodules: recursive | |
- name: 💡 The ${{ github.repository }} repository has been cloned to the runner. | |
run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
# Install Dependencies | |
- name: Install and Cache APT Packages | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: gnupg2 gcc g++ libfuse2 desktop-file-utils zsync # gcc-x86-64-linux-gnu g++-x86-64-linux-gnu | |
version: 1.0 | |
execute_install_scripts: true | |
# Install Dependencies | |
- name: Make Tools Directory | |
run: mkdir -p ${{ github.workspace }}/tools | |
- name: Install AppImageTool | |
uses: nick-fields/retry@v3 | |
with: | |
max_attempts: 3 | |
timeout_minutes: 60 | |
retry_on: error | |
command: | | |
# Install AppImageTool | |
#wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O ${{ github.workspace }}/tools/appimagetool | |
wget https://github.com/lexi-the-cute/appimagetool/releases/download/continuous/appimagetool-x86_64 -O ${{ github.workspace }}/tools/appimagetool | |
chmod +x ${{ github.workspace }}/tools/appimagetool | |
# Install Rust | |
- name: Download Rust Installer | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ${{ github.workspace }}/tools/rust.sh | |
- name: Make Rust Installer Executable | |
run: chmod +x ${{ github.workspace }}/tools/rust.sh | |
- name: Install Rust | |
run: ${{ github.workspace }}/tools/rust.sh -y | |
- name: Load Cargo Environment | |
run: source "$HOME/.cargo/env" | |
# Install Rust Stable Toolchains | |
- name: Set Rust To The Stable Toolchains | |
run: $HOME/.cargo/bin/rustup default stable | |
# Setup Rust Build Caching | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "linux-rust-gnu-x86_64" | |
# Add Build Targets | |
- name: Add x86_64 GNU Build Target | |
run: $HOME/.cargo/bin/rustup target add x86_64-unknown-linux-gnu | |
# Install Git Pre-Commit Hooks to Enforce Hooks | |
- name: Install Git Pre-Commit Hooks to Enforce Hooks | |
run: pip install pre-commit | |
# Check Pre-Commit Version | |
- name: Check Pre-Commit Version | |
run: pre-commit --version | |
# Install Pre-Commit Hooks | |
- name: Install Pre-Commit Hooks | |
run: pre-commit install | |
# Check Files with Pre-Commit Hooks | |
- name: Check Files with Pre-Commit Hooks | |
run: pre-commit run --all-files | |
# Install Cargo AppImage | |
- name: Install Cargo AppImage | |
run: cargo install --git https://github.com/foxgirl-labs/cargo-appimage # cargo-appimage | |
# Extract/Import GPG Signing Key | |
- name: Extract GPG Signing Key | |
run: | | |
echo "${{ secrets.GPG_SIGNING_KEY }}" > $HOME/signing.gpg | |
gpg --import $HOME/signing.gpg | |
# Modify Toml AppImageTools Args | |
- name: Modify Toml AppImageTools Args | |
run: sed -i "s/^args = \[\"--sign\"\]/args = \[\"--sign\", \"-u\", \"gh-releases-zsync|foxgirl-labs|catgirl-engine|latest|$APPIMAGE_FILENAME.zsync\"\]/" Cargo.toml | |
# Ignore Modifying Cargo.toml | |
- name: Ignore Modifying ${{ github.workspace }}/Cargo.toml | |
run: | | |
cd ${{ github.workspace }} | |
git update-index --skip-worktree ${{ github.workspace }}/Cargo.toml | |
# Compile Program | |
- name: Build Engine | |
run: | | |
# Sets the build timestamp to the current commit to make builds reproducible | |
export SOURCE_DATE_EPOCH="`git --no-pager log -1 --format="%at"`" | |
export PATH="${{ github.workspace }}/tools:$PATH" | |
# Release is already specified by cargo appimage | |
# https://github.com/StratusFearMe21/cargo-appimage/issues/30 | |
# https://github.com/StratusFearMe21/cargo-appimage/blob/485be0a4393a251b7c3b20487424209bb29f7374/src/main.rs#L18 | |
$HOME/.cargo/bin/cargo appimage --features appimage --verbose --target=x86_64-unknown-linux-gnu --bin catgirl-engine | |
# Display Export Directory | |
- name: Display Git Staging | |
run: | | |
cd ${{ github.workspace }} | |
git status -v -s -b | |
# Display Export Directory | |
- name: Display Export Directory | |
run: ls -liallh ${{ github.workspace }}/target/x86_64-unknown-linux-gnu/release | |
# Display AppImage Directory | |
- name: Display AppImage Directory | |
run: ls -liallh ${{ github.workspace }}/target/appimage | |
# Prepare Artifact Uploads | |
- name: Prepare Artifact Uploads (Client/Server) | |
run: | | |
mkdir -p ${{ github.workspace }}/upload/appimage | |
cp -a ${{ github.workspace }}/target/appimage/catgirl-engine.AppImage ${{ github.workspace }}/upload/appimage/$APPIMAGE_FILENAME | |
# Sign Files | |
- name: Sign Files (Client/Server) | |
run: | | |
cd ${{ github.workspace }}/upload/appimage | |
find . -type f -not -name "checksums.sha512" -exec shasum -a 512 {} \; > checksums.sha512 | |
gpg --sign checksums.sha512 | |
# Compress Files | |
- name: Compress Files (Client/Server) | |
run: | | |
export XZ_OPT=-e9 | |
cd ${{ github.workspace }}/upload/appimage | |
tar cvJf ${{ github.workspace }}/upload/CatgirlEngine-Linux-x86_64-GNU-AppImage.tar.xz . | |
# Upload Engine | |
- name: Upload Engine (Release) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CatgirlEngine-Linux-x86_64-GNU-AppImage-Tar | |
path: ${{ github.workspace }}/upload/CatgirlEngine-Linux-x86_64-GNU-AppImage.tar.xz | |
include-hidden-files: true | |
# List Environment | |
- name: List Environment | |
run: env | |
- name: List All Installed Packages | |
run: | | |
apt list --installed | wc -l | |
apt list --installed | |
- name: List All Files | |
run: find ${{ github.workspace }} | |
# Display Build Status | |
- name: 🍏 This job's status is ${{ job.status }}. | |
run: echo "🍏 This job's status is ${{ job.status }}." | |
deploy: | |
if: ${{ success() && (endsWith(github.event.head_commit.message, '--publish') || inputs.publish == 'yes') }} | |
needs: [Build] | |
runs-on: ubuntu-latest | |
environment: Linux | |
env: | |
BUTLER_API_KEY: ${{ secrets.ITCH_IO_API_KEY }} | |
GH_TOKEN: ${{ github.token }} | |
APPIMAGE_FILENAME: catgirl-engine-x86_64.AppImage | |
permissions: | |
# See https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
# See https://docs.github.com/en/rest/overview/permissions-required-for-fine-grained-personal-access-tokens | |
contents: write | |
steps: | |
# Setup Build Environment | |
- name: 🎉 The job was automatically triggered by a ${{ github.event_name }} event. | |
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- name: 🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub! | |
run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- name: 🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}. | |
run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
submodules: recursive | |
- name: 💡 The ${{ github.repository }} repository has been cloned to the runner. | |
run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
# Install Dependencies | |
- name: Install and Cache APT Packages | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: zsync # jq coreutils gitsome | |
version: 1.0 | |
execute_install_scripts: true | |
# Download Engine | |
- name: Download Engine (Release) | |
uses: actions/download-artifact@v4 | |
with: | |
name: CatgirlEngine-Linux-x86_64-GNU-AppImage-Tar | |
path: ${{ github.workspace }}/artifacts | |
# Compress Files | |
- name: Extract Files (Client/Server) | |
run: | | |
mkdir -p ${{ github.workspace }}/artifacts/linux-gnu-x86_64-appimage | |
cd ${{ github.workspace }}/artifacts | |
tar xvf ${{ github.workspace }}/artifacts/CatgirlEngine-Linux-x86_64-GNU-AppImage.tar.xz -C linux-gnu-x86_64-appimage | |
# Create Sync File | |
- name: Create Sync File | |
run: | | |
cd ${{ github.workspace }}/artifacts/linux-gnu-x86_64-appimage | |
zsyncmake $APPIMAGE_FILENAME | |
# Create Tag and Github Release | |
- name: 👩💻 Create Tag and Github Release | |
run: | | |
# TODO: Consider checking for -alpha and -beta to filter onto other packages | |
export VERSION=`cat ${{ github.workspace }}/Cargo.toml | grep '^version' | head -n1 | cut -d'"' -f2 | tr -d '\n'` | |
export VERSION_STRING="Catgirl Engine v$VERSION" | |
export BODY="Autogenerated Release From Github Actions..." | |
export DRAFT="false" | |
export PRERELEASE="false" | |
export LATEST="true" | |
export GENERATE_RELEASE_NOTES="true" | |
export BRANCH=`git branch --show-current --format="%s" | tr -d '\n'` | |
# export COMMIT=`git log -1 --oneline | cut -d' ' -f1 | tr -d '\n'` | |
gh api --method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/releases \ | |
-f tag_name="v$VERSION" \ | |
-f target_commitish="$BRANCH" \ | |
-f name="$VERSION_STRING" \ | |
-f body="$BODY" \ | |
-f make_latest="$LATEST" \ | |
-F draft="$DRAFT" \ | |
-F prerelease="$PRERELEASE" \ | |
-F generate_release_notes="$GENERATE_RELEASE_NOTES" || echo "Already Exists" | |
# Publish AppImage to Github Release | |
- name: 👩💻 Publish AppImage to Github Release | |
run: | | |
export VERSION=`cat ${{ github.workspace }}/Cargo.toml | grep '^version' | head -n1 | cut -d'"' -f2 | tr -d '\n'` | |
export ARTIFACT_PATH="${{ github.workspace }}/artifacts/linux-gnu-x86_64-appimage/$APPIMAGE_FILENAME" | |
export DISPLAY_LABEL="Linux AppImage Glibc (x86_64)" | |
gh release upload v$VERSION "$ARTIFACT_PATH"#"$DISPLAY_LABEL" -R ${{ github.repository }} | |
# Publish AppImage Sync File to Github Release | |
- name: 👩💻 Publish AppImage Sync File to Github Release | |
run: | | |
export VERSION=`cat ${{ github.workspace }}/Cargo.toml | grep '^version' | head -n1 | cut -d'"' -f2 | tr -d '\n'` | |
export ARTIFACT_PATH="${{ github.workspace }}/artifacts/linux-gnu-x86_64-appimage/$APPIMAGE_FILENAME.zsync" | |
export DISPLAY_LABEL="Linux AppImage Zsync Glibc (x86_64)" | |
gh release upload v$VERSION "$ARTIFACT_PATH"#"$DISPLAY_LABEL" -R ${{ github.repository }} | |
# Install Butler (For Uploading to Itch.io) | |
- name: Install Butler (Upload to Itch.io) | |
run: | | |
# https://itch.io/docs/butler/pushing.html#channel-names | |
# Setup For Installation | |
mkdir -p ${{ github.workspace }}/tools/butler | |
# Install Butler | |
wget https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default -O ${{ github.workspace }}/butler-linux-amd64.zip | |
unzip ${{ github.workspace }}/butler-linux-amd64.zip -d ${{ github.workspace }}/tools/butler | |
# Publish to Itch.io | |
- name: 🎮 Publish to Itch.io | |
run: | | |
# Upload App | |
${{ github.workspace }}/tools/butler/butler push ${{ github.workspace }}/artifacts/linux-gnu-x86_64-appimage/$APPIMAGE_FILENAME fomxgorl/catgirl-engine:linux-gnu-x86_64-appimage |