From 918ed20fc307a2995935181b51d09f7d4cf81783 Mon Sep 17 00:00:00 2001 From: Robin ALEXANDER Date: Mon, 19 Oct 2026 11:15:20 +0200 Subject: [PATCH] ci(workflows): get image and app versions from latest GitHub releases The build workflows no longer read the VERSION_LB_IMG and VERSION_LB_APP repository variables, which had to be updated by hand after each release. A new get-data job uses the gh CLI to look up the latest releases at run time: - build_image_develop.yml: the image version is the latest release of this repository. - build_image_release.yml: the image version is the latest release of this repository, and the app version is the latest release of librebooking/librebooking. Both workflows now call build_and_publish.yml through the $/ prefix instead of ./. GitHub recommends $/ for reusable workflows in the same repository, and it runs them at the same commit as the calling workflow. After this merges, the VERSION_LB_APP, VERSION_LB_IMG and DOCKER_REPOSITORY repository variables can be deleted. DOCKER_REPOSITORY was already unused. --- .github/workflows/build_image_develop.yml | 16 ++++++++++++++-- .github/workflows/build_image_release.yml | 23 ++++++++++++++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_image_develop.yml b/.github/workflows/build_image_develop.yml index e1eeb47..85164c4 100644 --- a/.github/workflows/build_image_develop.yml +++ b/.github/workflows/build_image_develop.yml @@ -6,12 +6,24 @@ on: workflow_dispatch: jobs: + get-data: + runs-on: ubuntu-latest + outputs: + releaseImg: ${{ steps.get_release_img.outputs.release }} + env: + GH_TOKEN: ${{ github.token }} + steps: + - + id: get_release_img + run: + echo "release=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)" >> "$GITHUB_OUTPUT" build-develop: - uses: ./.github/workflows/build_and_publish.yml + needs: get-data + uses: $/.github/workflows/build_and_publish.yml with: appGitRefs: develop appAddSha: true - imgBuild: ${{ vars.VERSION_LB_IMG }} + imgBuild: ${{ needs.get-data.outputs.releaseImg }} regName: ${{ vars.REGISTRY_URL }} regLogin: ${{ vars.REGISTRY_LOGIN }} secrets: diff --git a/.github/workflows/build_image_release.yml b/.github/workflows/build_image_release.yml index b0ff4dd..40fade3 100644 --- a/.github/workflows/build_image_release.yml +++ b/.github/workflows/build_image_release.yml @@ -4,12 +4,29 @@ on: workflow_dispatch: jobs: + get-data: + runs-on: ubuntu-latest + outputs: + releaseImg: ${{ steps.get_release_img.outputs.release }} + releaseApp: ${{ steps.get_release_app.outputs.release }} + env: + GH_TOKEN: ${{ github.token }} + steps: + - + id: get_release_img + run: + echo "release=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)" >> "$GITHUB_OUTPUT" + - + id: get_release_app + run: + echo "release=$(gh release view -R librebooking/librebooking --json tagName -q .tagName)" >> "$GITHUB_OUTPUT" build-stable: - uses: ./.github/workflows/build_and_publish.yml + needs: get-data + uses: $/.github/workflows/build_and_publish.yml with: - appGitRefs: ${{ vars.VERSION_LB_APP }} + appGitRefs: ${{ needs.get-data.outputs.releaseApp }} appAddSha: false - imgBuild: ${{ vars.VERSION_LB_IMG }} + imgBuild: ${{ needs.get-data.outputs.releaseImg }} regName: ${{ vars.REGISTRY_URL }} regLogin: ${{ vars.REGISTRY_LOGIN }} secrets: