From 3ae3de4b0a6404a696ef6112f356850921129700 Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 9 Nov 2026 17:06:24 +0100 Subject: [PATCH 01/10] Review instructions in file BUILD.md Apply Claude recommendations for BUILD.md --- BUILD.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/BUILD.md b/BUILD.md index 6d51aee..39efc90 100644 --- a/BUILD.md +++ b/BUILD.md @@ -9,13 +9,13 @@ You have 2 ways to get the docker image on your host: This is the easiest and fastest way. -- Stable branch: +- Librebooking [release](https://github.com/LibreBooking/librebooking/releases): ```sh - docker image pull librebooking/librebooking:4.0.0 + docker image pull librebooking/librebooking:7.2.0 ``` -- Development branch: +- Librebooking on-going development: ```sh docker image pull librebooking/librebooking:develop @@ -32,22 +32,21 @@ This is the easiest and fastest way. 1. Run the following commands on your host: ```sh - # Set the application release (ex: develop or v4.0.0) - APP_RELEASE=develop - if [ "${APP_RELEASE}" == "develop" ]; then - APP_GH_REF="refs/heads/${APP_RELEASE}" + # Set the application release if needed (ex: v7.2.0) + APP_GH_REF=v7.2.0 + if [ -z "${APP_GH_REF}" ]; then + IMG_TAG=develop APP_GH_ADD_SHA=true else - APP_GH_REF="refs/tags/${APP_RELEASE}" + IMG_TAG=${APP_GH_REF#[vV]} APP_GH_ADD_SHA=false fi - # Build the docker image - docker buildx build \ + # Build the docker image (Docker 23+) + docker build \ --build-arg APP_GH_REF=${APP_GH_REF} \ --build-arg APP_GH_ADD_SHA=${APP_GH_ADD_SHA} \ - --tag librebooking/librebooking:$(echo ${APP_RELEASE} | sed -e "s/^v//") \ - --output type=docker \ + --tag librebooking/librebooking:${IMG_TAG} \ . ``` From ed43635cfdb526755b4fe41d1cb0376df3c3f5a6 Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 9 Nov 2026 17:08:11 +0100 Subject: [PATCH 02/10] Prepare for branch renaming (from develop to main) Apply Claude recommedations for Dockerfile --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5a7c9d0..b7cc476 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,14 +7,18 @@ FROM composer:${VERSION_COMPOSER} AS comp # Get upstream FROM alpine/git:${VERSION_GIT} AS upstream ARG APP_GH_ADD_SHA=false -ARG APP_GH_REF=refs/heads/develop +ARG APP_GH_REF="" ARG UPSTREAM_URL="https://github.com/librebooking/librebooking" WORKDIR /upstream RUN <config/custom-version.txt fi From e76a78514983521eb06511a90662360ee7b4a5cf Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 9 Nov 2026 18:28:15 +0100 Subject: [PATCH 03/10] Drop the app tag for non-releases and add nightly tag --- .github/workflows/build_and_publish.yml | 10 +++++++--- .github/workflows/build_image_develop.yml | 2 +- .github/workflows/build_pull_request.yml | 2 -- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 40b5935..0faf6e5 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: appGitRefs: - required: true + required: false type: string appAddSha: required: false @@ -51,8 +51,12 @@ jobs: platforms: linux/amd64,linux/arm64 meta-images: ${{ inputs.regLogin }}/librebooking meta-tags: | - type=raw,value=${{ needs.prepare.outputs.appTag }},suffix=-${{ inputs.imgBuild }} - type=raw,value=${{ needs.prepare.outputs.appTag }} + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop,suffix=-${{ inputs.imgBuild }} + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly,suffix=-${{ inputs.imgBuild }} + type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }} + type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }},suffix=-${{ inputs.imgBuild }} build-args: | APP_GH_REF=${{ inputs.appGitRefs }} APP_GH_ADD_SHA=${{ inputs.appAddSha }} diff --git a/.github/workflows/build_image_develop.yml b/.github/workflows/build_image_develop.yml index 85164c4..c442927 100644 --- a/.github/workflows/build_image_develop.yml +++ b/.github/workflows/build_image_develop.yml @@ -21,7 +21,7 @@ jobs: needs: get-data uses: $/.github/workflows/build_and_publish.yml with: - appGitRefs: develop + appGitRefs: appAddSha: true imgBuild: ${{ needs.get-data.outputs.releaseImg }} regName: ${{ vars.REGISTRY_URL }} diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml index 4b71194..30c0d9f 100644 --- a/.github/workflows/build_pull_request.yml +++ b/.github/workflows/build_pull_request.yml @@ -46,7 +46,6 @@ jobs: check_build: runs-on: ubuntu-latest env: - APP_GH_REF: develop APP_GH_ADD_SHA: "true" services: mysql: @@ -79,7 +78,6 @@ jobs: build-args: | VERSION_PHP=8.4 VERSION_COMPOSER=lts - APP_GH_REF=${{ env.APP_GH_REF }} APP_GH_ADD_SHA=${{ env.APP_GH_ADD_SHA }} tags: librebooking-pr:${{ github.sha }} load: true From b6159f6cff877d985377d19b9470eba47a38f91b Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 9 Nov 2026 19:05:35 +0100 Subject: [PATCH 04/10] Switch to the "nightly" tag for on-going developments --- .examples/docker/README.md | 4 ++-- .examples/docker/docker-compose-local.yml | 4 ++-- .examples/docker/docker-compose-public.yml | 4 ++-- .examples/kubernetes/README.md | 2 +- .examples/podman/README.md | 4 ++-- BUILD.md | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.examples/docker/README.md b/.examples/docker/README.md index 42f8bda..1cd504a 100644 --- a/.examples/docker/README.md +++ b/.examples/docker/README.md @@ -39,7 +39,7 @@ docker run \ --volume librebooking-app_img:/var/www/html/Web/uploads/images \ --volume librebooking-app_res:/var/www/html/Web/uploads/reservation \ --env-file lb.env \ - docker.io/librebooking/librebooking:develop + docker.io/librebooking/librebooking:nightly docker run \ --name librebooking-cron \ @@ -48,7 +48,7 @@ docker run \ --volumes-from librebooking-app\ --volume ./crontab:/config/lb-jobs-cron:ro \ --env-file lb.env \ - docker.io/librebooking/librebooking:develop \ + docker.io/librebooking/librebooking:nightly \ supercronic /config/lb-jobs-cron ``` diff --git a/.examples/docker/docker-compose-local.yml b/.examples/docker/docker-compose-local.yml index 53d29db..acf59c0 100644 --- a/.examples/docker/docker-compose-local.yml +++ b/.examples/docker/docker-compose-local.yml @@ -9,7 +9,7 @@ services: env_file: - db.env app: - image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop} + image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly} restart: always depends_on: - db @@ -22,7 +22,7 @@ services: env_file: - lb.env cron: - image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop} + image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly} restart: always command: supercronic /config/lb-jobs-cron depends_on: diff --git a/.examples/docker/docker-compose-public.yml b/.examples/docker/docker-compose-public.yml index 0cd4db6..74ac90b 100644 --- a/.examples/docker/docker-compose-public.yml +++ b/.examples/docker/docker-compose-public.yml @@ -35,7 +35,7 @@ services: env_file: - db.env app: - image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop} + image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly} restart: always depends_on: - db @@ -51,7 +51,7 @@ services: - VIRTUAL_PORT=8080 - LETSENCRYPT_HOST=acme.org cron: - image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-develop} + image: ${DOCKER_APP_IMAGE:-librebooking/librebooking}:${DOCKER_APP_TAG:-nightly} restart: always depends_on: - app diff --git a/.examples/kubernetes/README.md b/.examples/kubernetes/README.md index a301a0d..efb293f 100644 --- a/.examples/kubernetes/README.md +++ b/.examples/kubernetes/README.md @@ -198,7 +198,7 @@ spec: # value: https://librebooking.example.com/Web # - name: VIRTUAL_HOST # value: librebooking.example.com - image: docker.io/librebooking/librebooking:develop + image: docker.io/librebooking/librebooking:nightly imagePullPolicy: IfNotPresent ports: - containerPort: 8080 diff --git a/.examples/podman/README.md b/.examples/podman/README.md index 1881224..61643ed 100644 --- a/.examples/podman/README.md +++ b/.examples/podman/README.md @@ -37,7 +37,7 @@ podman container create \ --volume librebooking-app_img:/var/www/html/Web/uploads/images:U \ --volume librebooking-app_res:/var/www/html/Web/uploads/reservation:U \ --env-file $(pwd)/lb.env \ - docker.io/librebooking/librebooking:develop + docker.io/librebooking/librebooking:nightly ``` If desired, add the cron container to the pod @@ -50,7 +50,7 @@ podman container create \ --volumes-from librebooking-app \ --volume $(pwd)/crontab:/config/lb-jobs-cron:U \ --env-file $(pwd)/lb.env \ - docker.io/librebooking/librebooking:develop \ + docker.io/librebooking/librebooking:nightly \ supercronic /config/lb-jobs-cron ``` diff --git a/BUILD.md b/BUILD.md index 39efc90..646e2f5 100644 --- a/BUILD.md +++ b/BUILD.md @@ -18,7 +18,7 @@ This is the easiest and fastest way. - Librebooking on-going development: ```sh - docker image pull librebooking/librebooking:develop + docker image pull librebooking/librebooking:nightly ``` ## Build the docker image @@ -35,7 +35,7 @@ This is the easiest and fastest way. # Set the application release if needed (ex: v7.2.0) APP_GH_REF=v7.2.0 if [ -z "${APP_GH_REF}" ]; then - IMG_TAG=develop + IMG_TAG=nightly APP_GH_ADD_SHA=true else IMG_TAG=${APP_GH_REF#[vV]} From 20eb2ffc176cc68a3b53a893ca7bef1470679fb8 Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Mon, 9 Nov 2026 19:06:05 +0100 Subject: [PATCH 05/10] Update the librebooking release version --- .examples/docker/.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.examples/docker/.env b/.examples/docker/.env index 87ab4f8..143c0da 100644 --- a/.examples/docker/.env +++ b/.examples/docker/.env @@ -4,7 +4,7 @@ # # optional Image Configuration #DOCKER_APP_IMAGE=librebooking/librebooking -#DOCKER_APP_TAG=5.2.0 +#DOCKER_APP_TAG=7.2.0 #DOCKER_DB_IMAGE=linuxserver/mariadb #DOCKER_DB_TAG:10.6.13 From 1056de149b7b58c21f6df38b16495898c9358d2f Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Tue, 10 Nov 2026 20:06:43 +0100 Subject: [PATCH 06/10] Code refactoring --- .github/workflows/build_and_publish.yml | 34 +++++++++++++++-------- .github/workflows/build_image_develop.yml | 18 ++---------- .github/workflows/build_image_release.yml | 9 ++---- .github/workflows/build_on_request.yml | 7 ++--- 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 0faf6e5..c00267d 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -11,7 +11,7 @@ on: type: boolean default: false imgBuild: - required: true + required: false type: string regName: required: true @@ -31,14 +31,26 @@ jobs: prepare: runs-on: ubuntu-latest outputs: - appTag: ${{ steps.get_meta.outputs.appTag }} + tag: ${{ steps.get_tag.outputs.release }} + tagSuffix: ${{ steps.get_tag_suffix.outputs.release }} + env: + GH_TOKEN: ${{ github.token }} steps: - - name: Get the docker image metadata - id: get_meta + name: Get the docker image tag + id: get_tag run: | appTag=$(basename ${{ inputs.appGitRefs }} | sed -e "s/^[vV]//") - echo "appTag=$appTag" >> $GITHUB_OUTPUT + echo "release=$appTag" >> $GITHUB_OUTPUT + - + name: Get the docker image tag suffix + id: get_tag_suffix + run: | + if [ "${{ inputs.imgBuild }}" == "" ]; then + echo "release=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)" >> "$GITHUB_OUTPUT" + else + echo "release=${{ inputs.imgBuild }}" >> "$GITHUB_OUTPUT" + fi build: needs: prepare uses: docker/github-builder/.github/workflows/build.yml@v1 @@ -51,12 +63,12 @@ jobs: platforms: linux/amd64,linux/arm64 meta-images: ${{ inputs.regLogin }}/librebooking meta-tags: | - type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop - type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop,suffix=-${{ inputs.imgBuild }} - type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly - type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly,suffix=-${{ inputs.imgBuild }} - type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }} - type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }},suffix=-${{ inputs.imgBuild }} + type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=nightly + type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=nightly,suffix=-${{ needs.prepare.outputs.tagSuffix }} + type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=develop + type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=develop,suffix=-${{ needs.prepare.outputs.tagSuffix }} + type=raw,enable=${{ needs.prepare.outputs.tag != '' }},value=${{ needs.prepare.outputs.tag }} + type=raw,enable=${{ needs.prepare.outputs.tag != '' }},value=${{ needs.prepare.outputs.tag }},suffix=-${{ needs.prepare.outputs.tagSuffix }} build-args: | APP_GH_REF=${{ inputs.appGitRefs }} APP_GH_ADD_SHA=${{ inputs.appAddSha }} diff --git a/.github/workflows/build_image_develop.yml b/.github/workflows/build_image_develop.yml index c442927..943c341 100644 --- a/.github/workflows/build_image_develop.yml +++ b/.github/workflows/build_image_develop.yml @@ -1,4 +1,4 @@ -name: Build develop image +name: Build nightly image on: schedule: @@ -6,24 +6,10 @@ 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: - needs: get-data + build-nightly: uses: $/.github/workflows/build_and_publish.yml with: - appGitRefs: appAddSha: true - 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 40fade3..78af200 100644 --- a/.github/workflows/build_image_release.yml +++ b/.github/workflows/build_image_release.yml @@ -7,26 +7,21 @@ 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 + name: Get Librebooking latest release number run: echo "release=$(gh release view -R librebooking/librebooking --json tagName -q .tagName)" >> "$GITHUB_OUTPUT" - build-stable: + build-release: needs: get-data uses: $/.github/workflows/build_and_publish.yml with: appGitRefs: ${{ needs.get-data.outputs.releaseApp }} appAddSha: false - imgBuild: ${{ needs.get-data.outputs.releaseImg }} regName: ${{ vars.REGISTRY_URL }} regLogin: ${{ vars.REGISTRY_LOGIN }} secrets: diff --git a/.github/workflows/build_on_request.yml b/.github/workflows/build_on_request.yml index 6256bbf..fec7af0 100644 --- a/.github/workflows/build_on_request.yml +++ b/.github/workflows/build_on_request.yml @@ -4,13 +4,11 @@ on: workflow_dispatch: inputs: appGitRefs: - required: true + required: false description: 'Librebooking/librebooking version' - default: 'develop' imgBuild: - required: true + required: false description: 'Librebooking/docker version' - default: '2.5.0' regName: required: true description: 'Registry name' @@ -25,6 +23,7 @@ jobs: uses: ./.github/workflows/build_and_publish.yml with: appGitRefs: ${{ inputs.appGitRefs }} + appAddSha: ${{ inputs.appGitRefs == '' }} imgBuild: ${{ inputs.imgBuild }} regName: ${{ inputs.regName }} regLogin: ${{ inputs.regLogin }} From 3cdb5f029c6bd50f7174420f23eb9eeaf252a830 Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Wed, 11 Nov 2026 13:28:55 +0100 Subject: [PATCH 07/10] Manage the :latest tag --- .github/workflows/build_and_publish.yml | 53 +++++++++++++++++-------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index c00267d..446724a 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -31,25 +31,45 @@ jobs: prepare: runs-on: ubuntu-latest outputs: - tag: ${{ steps.get_tag.outputs.release }} - tagSuffix: ${{ steps.get_tag_suffix.outputs.release }} + appTag: ${{ steps.set_app_tag.outputs.appTag }} + imgTag: ${{ steps.set_img_tag.outputs.imgTag }} + latest: ${{ steps.set_latest.output.latest }} env: GH_TOKEN: ${{ github.token }} steps: - - name: Get the docker image tag - id: get_tag + id: get_latest_tags + name: Check latest releases for librebooking/librebooking and librebooking/docker + run: | + latestAppTag=$(gh release view -R librebooking/librebooking --json tagName -q .tagName) + echo "latestAppTag=$latestAppTag" >> $GITHUB_OUTPUT + latestImgTag=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName) + echo "latestImgTag=$latestImgTag" >> $GITHUB_OUTPUT + - + id: set_app_tag + name: Set the application tag run: | appTag=$(basename ${{ inputs.appGitRefs }} | sed -e "s/^[vV]//") - echo "release=$appTag" >> $GITHUB_OUTPUT + echo "appTag=$appTag" >> $GITHUB_OUTPUT + + - + id: set_img_tag + name: Set the image tag + run: | + if [ -z "${{ inputs.imgBuild }}" ]; then + echo "imgTag=${{ steps.get_latest_tags.outputs.latestImgTag }}" >> "$GITHUB_OUTPUT" + else + echo "imgTag=${{ inputs.imgBuild }}" >> "$GITHUB_OUTPUT" + fi - - name: Get the docker image tag suffix - id: get_tag_suffix + id: set_latest + name: Check if this is the latest stable run: | - if [ "${{ inputs.imgBuild }}" == "" ]; then - echo "release=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName)" >> "$GITHUB_OUTPUT" + if [ "${{ steps.set_app_tag.outputs.appTag }}" == "${{ steps.get_latest_tags.outputs.latestAppTag}}" ] \ + && [ "${{ steps.set_img_tag.outputs.imgTag }}" == "${{ steps.get_latest_tags.outputs.latestImgTag}}" ] ; then + echo "latest=true" >> "$GITHUB_OUTPUT" else - echo "release=${{ inputs.imgBuild }}" >> "$GITHUB_OUTPUT" + echo "latest=false" >> "$GITHUB_OUTPUT" fi build: needs: prepare @@ -63,12 +83,13 @@ jobs: platforms: linux/amd64,linux/arm64 meta-images: ${{ inputs.regLogin }}/librebooking meta-tags: | - type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=nightly - type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=nightly,suffix=-${{ needs.prepare.outputs.tagSuffix }} - type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=develop - type=raw,enable=${{ needs.prepare.outputs.tag == '' }},value=develop,suffix=-${{ needs.prepare.outputs.tagSuffix }} - type=raw,enable=${{ needs.prepare.outputs.tag != '' }},value=${{ needs.prepare.outputs.tag }} - type=raw,enable=${{ needs.prepare.outputs.tag != '' }},value=${{ needs.prepare.outputs.tag }},suffix=-${{ needs.prepare.outputs.tagSuffix }} + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=nightly,suffix=-${{ needs.prepare.outputs.imgTag }} + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop + type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop,suffix=-${{ needs.prepare.outputs.imgTag }} + type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }} + type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }},suffix=-${{ needs.prepare.outputs.imgTag }} + type=raw,enable=${{ needs.prepare.outputs.latest == true }},value=latest build-args: | APP_GH_REF=${{ inputs.appGitRefs }} APP_GH_ADD_SHA=${{ inputs.appAddSha }} From af2bdfd0700da3d52da2e60998531b21a6407aa9 Mon Sep 17 00:00:00 2001 From: Robin Alexander Date: Wed, 11 Nov 2026 14:00:42 +0100 Subject: [PATCH 08/10] Miscelanneous fixes and simplifications --- .github/workflows/build_and_publish.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 446724a..f6ab517 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -33,7 +33,7 @@ jobs: outputs: appTag: ${{ steps.set_app_tag.outputs.appTag }} imgTag: ${{ steps.set_img_tag.outputs.imgTag }} - latest: ${{ steps.set_latest.output.latest }} + latest: ${{ steps.set_latest.outputs.latest }} env: GH_TOKEN: ${{ github.token }} steps: @@ -42,34 +42,39 @@ jobs: name: Check latest releases for librebooking/librebooking and librebooking/docker run: | latestAppTag=$(gh release view -R librebooking/librebooking --json tagName -q .tagName) - echo "latestAppTag=$latestAppTag" >> $GITHUB_OUTPUT + echo "latestAppTag=${latestAppTag#[vV]}" >> $GITHUB_OUTPUT latestImgTag=$(gh release view -R ${{ github.repository }} --json tagName -q .tagName) - echo "latestImgTag=$latestImgTag" >> $GITHUB_OUTPUT + echo "latestImgTag=${latestImgTag#[vV]}" >> $GITHUB_OUTPUT - id: set_app_tag name: Set the application tag run: | - appTag=$(basename ${{ inputs.appGitRefs }} | sed -e "s/^[vV]//") - echo "appTag=$appTag" >> $GITHUB_OUTPUT + if [ -z "${{ inputs.appGitRefs }}" ]; then + appTag="" + else + appTag=$(basename ${{ inputs.appGitRefs }}) + fi + echo "appTag=${appTag#[vV]}" >> $GITHUB_OUTPUT - id: set_img_tag name: Set the image tag run: | if [ -z "${{ inputs.imgBuild }}" ]; then - echo "imgTag=${{ steps.get_latest_tags.outputs.latestImgTag }}" >> "$GITHUB_OUTPUT" + imgTag=${{ steps.get_latest_tags.outputs.latestImgTag }} else - echo "imgTag=${{ inputs.imgBuild }}" >> "$GITHUB_OUTPUT" + imgTag=${{ inputs.imgBuild }} fi + echo "imgTag=${imgTag#[vV]}" >> "$GITHUB_OUTPUT" - id: set_latest name: Check if this is the latest stable run: | if [ "${{ steps.set_app_tag.outputs.appTag }}" == "${{ steps.get_latest_tags.outputs.latestAppTag}}" ] \ && [ "${{ steps.set_img_tag.outputs.imgTag }}" == "${{ steps.get_latest_tags.outputs.latestImgTag}}" ] ; then - echo "latest=true" >> "$GITHUB_OUTPUT" + echo "latest=${{ true }}" >> "$GITHUB_OUTPUT" else - echo "latest=false" >> "$GITHUB_OUTPUT" + echo "latest=${{ false }}" >> "$GITHUB_OUTPUT" fi build: needs: prepare @@ -89,7 +94,7 @@ jobs: type=raw,enable=${{ needs.prepare.outputs.appTag == '' }},value=develop,suffix=-${{ needs.prepare.outputs.imgTag }} type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }} type=raw,enable=${{ needs.prepare.outputs.appTag != '' }},value=${{ needs.prepare.outputs.appTag }},suffix=-${{ needs.prepare.outputs.imgTag }} - type=raw,enable=${{ needs.prepare.outputs.latest == true }},value=latest + type=raw,enable=${{ needs.prepare.outputs.latest }},value=latest build-args: | APP_GH_REF=${{ inputs.appGitRefs }} APP_GH_ADD_SHA=${{ inputs.appAddSha }} From 465cfe0c49ea79ed7a1f998211479e665da012d2 Mon Sep 17 00:00:00 2001 From: Robin ALEXANDER Date: Thu, 12 Nov 2026 12:24:15 +0100 Subject: [PATCH 09/10] Mitigate security risks --- .github/workflows/build_and_publish.yml | 27 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index f6ab517..ea4feb1 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -48,33 +48,42 @@ jobs: - id: set_app_tag name: Set the application tag + env: + appGitRefs: ${{ inputs.appGitRefs }} run: | - if [ -z "${{ inputs.appGitRefs }}" ]; then + if [ -z "${appGitRefs}" ]; then appTag="" else - appTag=$(basename ${{ inputs.appGitRefs }}) + appTag=$(basename "${appGitRefs}") fi echo "appTag=${appTag#[vV]}" >> $GITHUB_OUTPUT - id: set_img_tag name: Set the image tag + env: + imgBuild: ${{ inputs.imgBuild }} + latestImgTag: ${{ steps.get_latest_tags.outputs.latestImgTag }} run: | - if [ -z "${{ inputs.imgBuild }}" ]; then - imgTag=${{ steps.get_latest_tags.outputs.latestImgTag }} + if [ -z "${imgBuild}" ]; then + imgTag="${latestImgTag}" else - imgTag=${{ inputs.imgBuild }} + imgTag="${imgBuild}" fi echo "imgTag=${imgTag#[vV]}" >> "$GITHUB_OUTPUT" - id: set_latest name: Check if this is the latest stable + env: + appTag: ${{ steps.set_app_tag.outputs.appTag }} + imgTag: ${{ steps.set_img_tag.outputs.imgTag }} + latestAppTag: ${{ steps.get_latest_tags.outputs.latestAppTag }} + latestImgTag: ${{ steps.get_latest_tags.outputs.latestImgTag }} run: | - if [ "${{ steps.set_app_tag.outputs.appTag }}" == "${{ steps.get_latest_tags.outputs.latestAppTag}}" ] \ - && [ "${{ steps.set_img_tag.outputs.imgTag }}" == "${{ steps.get_latest_tags.outputs.latestImgTag}}" ] ; then - echo "latest=${{ true }}" >> "$GITHUB_OUTPUT" + if [ "${appTag}" = "${latestAppTag}" ] && [ "${imgTag}" = "${latestImgTag}" ]; then + echo "latest=true" >> "$GITHUB_OUTPUT" else - echo "latest=${{ false }}" >> "$GITHUB_OUTPUT" + echo "latest=false" >> "$GITHUB_OUTPUT" fi build: needs: prepare From 624b2d4e6820c538de209055a206feb7dbb56732 Mon Sep 17 00:00:00 2001 From: Robin ALEXANDER Date: Mon, 16 Nov 2026 09:26:06 +0100 Subject: [PATCH 10/10] Potential fix for pull request finding 'Normalize branch refs before checkout' `git clone` does not accept a branch path such as refs/heads/branch_name or refs/tags/tag_name. If/when github action is called by the upstream repository (librebooking/librebooking) we should make sure to keep the basename only Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b7cc476..46341d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ set -eu git clone "${UPSTREAM_URL}" . if [ -n "${APP_GH_REF}" ]; then - git checkout "${APP_GH_REF}" + git checkout "${APP_GH_REF#refs/heads/}" fi if [ "${APP_GH_ADD_SHA}" = "true" ]; then