Skip to content

Commit

Permalink
ci: start scaffolding a build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
USA-RedDragon committed Nov 27, 2023
1 parent e200c06 commit b22ca40
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 4 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

on:
push:
branches-ignore:
- rebase-pull-request**
- cherry-pick-rebase-pull-request**
- flatpak-repository
pull_request:

concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get update -y
sudo apt-get install --no-install-recommends -y \
icoutils \
flatpak \
flatpak-builder \
elfutils
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Cache Flatpak builder
id: cache-flatpak-builder
uses: actions/cache@v3
with:
path: .flatpak-builder
key: ${{ runner.os }}-flatpak-builder-${{ hashFiles('com.jagex.Launcher.yaml') }}
- name: Build Flatpak
run: |
./build.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ out/
export/
resources/icons/*.png
*.flatpak
repo/
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,20 @@ This is a Flatpak package for the Jagex Launcher. It packages the [official upst

### Installing the Launcher

It is unlikely that Flathub would accept a proprietary application like the Jagex Launcher, paricularly one that is wrapped in Wine. As such, this Flatpak is not available on Flathub. You can install it by downloading the [latest release](https://github.com/USA-RedDragon/jagex-launcher-flatpak/releases/latest) and installing it with the following command:
It is unlikely that Flathub would accept a proprietary application like the Jagex Launcher, paricularly one that is wrapped in Wine. As such, this Flatpak is not available on Flathub.

### Flatpak Remote

You can install it by adding the remote and installing it with the following commands:

```bash
flatpak remote-add --if-not-exists usareddragon https://jagexlauncher.flatpak.mcswain.dev/.flatpakrepo
flatpak install --user usareddragon com.jagex.Launcher
```

### Manual Download

You can install it by downloading the [latest release](https://github.com/USA-RedDragon/jagex-launcher-flatpak/releases/latest) and installing it with the following command:

```bash
flatpak install --user com.jagex.Launcher.flatpak
Expand Down
47 changes: 44 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

set -euo pipefail

# Dosign should be 1 if $1 is set
DOSIGN=0
if [[ ! -z ${1+x} ]]; then
DOSIGN=1
fi

# renovate: datasource=git-tags depName=https://gitlab.com/freedesktop-sdk/freedesktop-sdk.git
FREEDESKTOP_SDK_GIT_VERSION=freedesktop-sdk-23.08.6
FREEDESKTOP_SDK_VERSION=$(echo ${FREEDESKTOP_SDK_GIT_VERSION} | cut -d'-' -f3 | cut -d'.' -f1-2)
Expand Down Expand Up @@ -33,8 +39,43 @@ if [[ ${HAS_NVIDIA} -eq 1 ]]; then
org.freedesktop.Platform.GL32.nvidia-${NVIDIA_VERISON}/x86_64
fi

flatpak-builder --user --force-clean out com.jagex.Launcher.yaml
flatpak build-export export out
flatpak build-bundle -vv export com.jagex.Launcher.flatpak com.jagex.Launcher --repo-url=https://flatpak.mcswain.dev --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
REPO_ARGS=""
GPG_ARGS=""
if [[ ${DOSIGN} -eq 1 ]]; then
REPO_ARGS="--repo ./repo"
GPG_ARGS="--gpg-sign=7ADE1CA57A2E2272"
fi

flatpak-builder ${REPO_ARGS} ${GPG_ARGS} --default-branch=stable --user --ccache --force-clean out com.jagex.Launcher.yaml
if [[ ${DOSIGN} -eq 0 ]]; then
flatpak build-export repo out
fi
flatpak build-update-repo ${GPG_ARGS} repo --title="Jagex Launcher" --generate-static-deltas --default-branch=stable

flatpak build-bundle ${GPG_ARGS} --repo-url=https://jagexlauncher.flatpak.mcswain.dev --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo repo com.jagex.Launcher.flatpak com.jagex.Launcher stable &
PID=$!

COUNTER=0
# Timeout after 1 hour
MAX_COUNTER=3600
while kill -0 $PID 2> /dev/null; do
NUM_DOT=$((COUNTER%5))
DOTS=$(printf '.%.0s' $(seq 0 $NUM_DOT))
# Overwrite the line
echo "Exporting flatpak${DOTS}"
COUNTER=$((COUNTER+1))
if [[ ${COUNTER} -gt ${MAX_COUNTER} ]]; then
echo "Timed out after 1 hour"
exit 1
fi
sleep 1
done

# Check exit code
wait $PID
if [[ $? -ne 0 ]]; then
echo "Failed to export flatpak"
exit 1
fi

echo "Built flatpak to com.jagex.Launcher.flatpak"

0 comments on commit b22ca40

Please sign in to comment.