From c062980072b8323bca263f28c7e318573704f256 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Sun, 19 Nov 2023 12:22:09 +0100 Subject: [PATCH] CI: Let github workflow use version number in the flatpak filename Note: For pull requests, the version that is tested is an autogenerated temporary merge commit (which is good, since it tests whether things work *after* merging), but that commit id is also included in the filename which might be bit suprising. To be considered later. --- .github/workflows/testing.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 434a9dc99..7eac188e6 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -82,6 +82,10 @@ jobs: steps: - name: Prepare repo uses: actions/checkout@v2 + # Fetch history, so we also fetch the previous tag for deriving + # the version number + with: + fetch-depth: 0 - name: Install system packages # It would be good to cache the GNOME Sdk, as it # is rather big to download each time. @@ -105,10 +109,14 @@ jobs: - name: Export bundle and try to install it run: | mkdir -p dist - flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo build/flatpak/repo dist/Hamster.flatpak org.gnome.Hamster - flatpak --user -y install dist/Hamster.flatpak + # Note: For pull requests, this version includes the git hash + # of the autogenerated *merge* commit, not the original + # to-be-merged commit (because that's also what is tested). + VERSION=$(python src/hamster/version.py) + flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo build/flatpak/repo "dist/Hamster-$VERSION.flatpak" org.gnome.Hamster + flatpak --user -y install "dist/Hamster-$VERSION.flatpak" - name: Upload built artifact uses: actions/upload-artifact@v2 with: name: Flatpak application - path: dist/Hamster.flatpak + path: dist/*.flatpak