From c6d0ebc59faa68c1eb25a72897685420abbb2d73 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 25 Oct 2023 12:48:49 +0200 Subject: [PATCH 1/6] Rename tag to docker_tag --- .github/workflows/build_and_push.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 1798b50f2..56000c9b5 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -21,7 +21,7 @@ jobs: VERSION=${GITHUB_REF#refs/tags/v} fi TAG=${VERSION} - echo ::set-output name=tag::${TAG} + echo ::set-output name=docker_tag::${TAG} git submodule update --init --recursive --depth 1 - name: Set up Docker Buildx @@ -61,7 +61,7 @@ jobs: context: ./docker-app file: ./docker-app/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: opengisch/qfieldcloud-app:${{ steps.prepare.outputs.tag }} + tags: opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_tag }} - name: Docker Build and Push Worker id: docker_build_and_push_worker @@ -72,7 +72,7 @@ jobs: context: ./docker-app file: ./docker-app/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.tag }} + tags: opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_tag }} # QGIS - name: Docker Test QGIS @@ -91,7 +91,7 @@ jobs: context: ./docker-qgis file: ./docker-qgis/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.tag }} + tags: opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_tag }} - name: Trigger deployment on private repository uses: peter-evans/repository-dispatch@v1 @@ -99,4 +99,4 @@ jobs: token: ${{ secrets.GIT_ACCESS_TOKEN }} repository: opengisch/qfieldcloud-private event-type: public_dispatch - client-payload: '{"version": "${{ steps.prepare.outputs.tag }}"}' + client-payload: '{"version": "${{ steps.prepare.outputs.docker_tag }}"}' From 23b63c4e593e2030e8b8626f49f14b46ceb59e3f Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 25 Oct 2023 12:50:02 +0200 Subject: [PATCH 2/6] Replace deprecated set-output command --- .github/workflows/build_and_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 56000c9b5..631dfb5a7 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -21,7 +21,7 @@ jobs: VERSION=${GITHUB_REF#refs/tags/v} fi TAG=${VERSION} - echo ::set-output name=docker_tag::${TAG} + echo "docker_tag=${TAG}" >> $GITHUB_OUTPUT git submodule update --init --recursive --depth 1 - name: Set up Docker Buildx From a77a35c975027ec015fb933cd61fccf98b27cc70 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 25 Oct 2023 12:58:26 +0200 Subject: [PATCH 3/6] Push git sha next to latest and version tags --- .github/workflows/build_and_push.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 631dfb5a7..4d3d4ba31 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - docker_tags tags: - "v*.*.*" jobs: @@ -15,13 +16,13 @@ jobs: - name: Prepare id: prepare run: | - VERSION="latest" - TAG="" + TAG="latest" + COMMIT="${GITHUB_SHA}" if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/v} + TAG=${GITHUB_REF#refs/tags/v} fi - TAG=${VERSION} echo "docker_tag=${TAG}" >> $GITHUB_OUTPUT + echo "docker_commit=${COMMIT}" >> $GITHUB_OUTPUT git submodule update --init --recursive --depth 1 - name: Set up Docker Buildx @@ -61,7 +62,9 @@ jobs: context: ./docker-app file: ./docker-app/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_tag }} + tags: | + opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_tag }} + opengisch/qfieldcloud-app:${{ steps.prepare.outputs.docker_commit }} - name: Docker Build and Push Worker id: docker_build_and_push_worker @@ -72,7 +75,9 @@ jobs: context: ./docker-app file: ./docker-app/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_tag }} + tags: | + opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_tag }} + opengisch/qfieldcloud-worker-wrapper:${{ steps.prepare.outputs.docker_commit }} # QGIS - name: Docker Test QGIS @@ -91,7 +96,9 @@ jobs: context: ./docker-qgis file: ./docker-qgis/Dockerfile push: ${{ github.event_name != 'pull_request' }} - tags: opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_tag }} + tags: | + opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_tag }} + opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_commit }} - name: Trigger deployment on private repository uses: peter-evans/repository-dispatch@v1 From 3743e7909ffa9d6e1d0e75038a683236da6a81f2 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 25 Oct 2023 13:52:13 +0200 Subject: [PATCH 4/6] Use `commit-shortSha` for docker image tags --- .github/workflows/build_and_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 4d3d4ba31..9cb692e3f 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -17,7 +17,7 @@ jobs: id: prepare run: | TAG="latest" - COMMIT="${GITHUB_SHA}" + COMMIT="commit-$(git rev-parse --short ${{ github.sha }})" if [[ $GITHUB_REF == refs/tags/* ]]; then TAG=${GITHUB_REF#refs/tags/v} fi From d7bb9a8fb45210531c05de6328bf7db5ddf2cf72 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 25 Oct 2023 13:53:08 +0200 Subject: [PATCH 5/6] Do not autodeploy latest public --- .github/workflows/build_and_push.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 9cb692e3f..6ab1f9f70 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -99,11 +99,3 @@ jobs: tags: | opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_tag }} opengisch/qfieldcloud-qgis:${{ steps.prepare.outputs.docker_commit }} - - - name: Trigger deployment on private repository - uses: peter-evans/repository-dispatch@v1 - with: - token: ${{ secrets.GIT_ACCESS_TOKEN }} - repository: opengisch/qfieldcloud-private - event-type: public_dispatch - client-payload: '{"version": "${{ steps.prepare.outputs.docker_tag }}"}' From 648cc98fcad50a216fe52dbd99b2bcf0a4d31386 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 25 Oct 2023 13:57:31 +0200 Subject: [PATCH 6/6] Remove test condition --- .github/workflows/build_and_push.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 6ab1f9f70..8cb55558b 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -3,7 +3,6 @@ on: push: branches: - master - - docker_tags tags: - "v*.*.*" jobs: