Skip to content

Commit

Permalink
ci: flatpak improvements
Browse files Browse the repository at this point in the history
Generate a Preview release with the Amiberry flatpak automatically
  • Loading branch information
midwan committed Nov 9, 2023
1 parent 2c69c42 commit 5a2a02d
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 8 deletions.
44 changes: 42 additions & 2 deletions .github/workflows/flatpak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,51 @@ jobs:
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
options: --privileged

steps:
- uses: actions/checkout@v4
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6

- name: Generate AppStream XML
run: |
./flatpak/generate-metainfo.sh ./flatpak
cat ./flatpak/com.blitterstudio.amiberry.metainfo.xml
- name: Build Flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@v6.1
with:
bundle: amiberry.flatpak
manifest-path: ./flatpak/com.blitterstudio.amiberry.yml
cache-key: flatpak-builder-${{ github.sha }}
arch: x86_64
build-bundle: true
verbose: true
branch: preview
cache: true
restore-cache: true
cache-key: flatpak-builder-${{ github.sha }}

- name: Upload Flatpak
uses: actions/upload-artifact@v3
with:
name: "linux-flatpak"
path: "amiberry.flatpak"

create-release:
needs: [flatpak]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/preview'
steps:
- name: Download Flatpak artifact
uses: actions/download-artifact@v1
with:
name: "linux-flatpak"

- name: Create Preview release
if: github.ref == 'refs/heads/preview'
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "preview"
prerelease: true
title: "Latest Preview Build"
files: |
linux-flatpak/amiberry.flatpak
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

<metadata_license>FSFAP</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<update_contact>midwan_AT_gmail.com</update_contact>
<url type="homepage">https://amiberry.com</url>
<url type="help">https://github.com/BlitterStudio/amiberry/wiki</url>
<url type="vcs-browser">https://github.com/BlitterStudio/amiberry/wiki</url>

<supports>
<control>pointing</control>
Expand All @@ -18,18 +21,16 @@
</supports>

<description>
<p>
Amiberry is an optimized Amiga emulator for Linux (ARM, ARM64 and x86-64).
It is based on the latest WinUAE, with several unique features on top of it,
like a WHDLoad booter, custom controls, Host-Run functionality and more.
</p>
<p>Amiberry is an optimized Amiga emulator for Linux (ARM, ARM64 and x86-64).</p>
<p>It is based on the latest WinUAE, with several unique features on top of it,</p>
<p>like a WHDLoad booter, custom controls, Host-Run functionality and more.</p>
</description>
<screenshots>
<screenshot type="default">
<image>https://i0.wp.com/blitterstudio.com/wp-content/uploads/2022/12/Screenshot_GUI.png</image>
</screenshot>
</screenshots>
<releases>
<release version="6.0.0" date="2023-11-08"/>
<release version="@GIT_VERSION@" date="@GIT_DATE@" />
</releases>
</component>
32 changes: 32 additions & 0 deletions flatpak/generate-metainfo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

SCRIPTDIR=$(realpath $(dirname "${BASH_SOURCE[0]}"))

if [[ $# -lt 1 ]]; then
echo "Output directory must be provided as a parameter"
exit 1
fi

APPID="com.blitterstudio.amiberry"
OUTDIR=$(realpath "$1")
OUTFILE="${OUTDIR}/${APPID}.metainfo.xml"

pushd "${SCRIPTDIR}" >/dev/null || exit
GIT_DATE=$(git log -1 --pretty=%cd --date=short)
GIT_HASH=$(git rev-parse HEAD)
GIT_VERSION=$(git describe --dirty | tr -d '\r\n')
if [[ "${GIT_VERSION}" == "" ]]; then
GIT_VERSION=$(git rev-parse HEAD)
fi

popd >/dev/null || exit

echo "GIT_DATE: ${GIT_DATE}"
echo "GIT_VERSION: ${GIT_VERSION}"
echo "GIT_HASH: ${GIT_HASH}"

cp "${SCRIPTDIR}/${APPID}.metainfo.xml.in" "${OUTFILE}"

sed -i -e "s/@GIT_VERSION@/${GIT_VERSION}/" "${OUTFILE}"
sed -i -e "s/@GIT_DATE@/${GIT_DATE}/" "${OUTFILE}"
sed -i -e "s/@GIT_HASH@/${GIT_HASH}/" "${OUTFILE}"

0 comments on commit 5a2a02d

Please sign in to comment.