From f9d9b0e07e517cb74c98e7a61be542d90d4dcb60 Mon Sep 17 00:00:00 2001 From: Amund Isaksen <31344542+Teddy-1000@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:27:40 +0200 Subject: [PATCH 1/5] Update registry_upload.yml --- .github/workflows/registry_upload.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/registry_upload.yml b/.github/workflows/registry_upload.yml index 63514f6e..ad60680c 100644 --- a/.github/workflows/registry_upload.yml +++ b/.github/workflows/registry_upload.yml @@ -7,6 +7,9 @@ on: branches: [main] types: - completed + push: + tags: + - '*' # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: @@ -68,6 +71,8 @@ jobs: tags: | type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=ref,event=tag,enable={{is_default_branch}} + type=semver,pattern={{version}} + - name: Install just run: ./ci/scripts/install-just.sh From 8e2e223554df9e0c58572f61d557e4cf4083dfa6 Mon Sep 17 00:00:00 2001 From: Amund Isaksen Date: Wed, 2 Oct 2024 14:52:55 +0200 Subject: [PATCH 2/5] Fix yaml formatting --- .github/workflows/registry_upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/registry_upload.yml b/.github/workflows/registry_upload.yml index ad60680c..5532bce5 100644 --- a/.github/workflows/registry_upload.yml +++ b/.github/workflows/registry_upload.yml @@ -72,7 +72,7 @@ jobs: type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=ref,event=tag,enable={{is_default_branch}} type=semver,pattern={{version}} - + - name: Install just run: ./ci/scripts/install-just.sh From 2143976b761ff85f834a7398358ca918a92e8e1c Mon Sep 17 00:00:00 2001 From: Amund Isaksen Date: Thu, 3 Oct 2024 07:18:34 +0200 Subject: [PATCH 3/5] Change tag strategy --- .github/workflows/registry_upload.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/registry_upload.yml b/.github/workflows/registry_upload.yml index 5532bce5..8e7e9e96 100644 --- a/.github/workflows/registry_upload.yml +++ b/.github/workflows/registry_upload.yml @@ -9,7 +9,7 @@ on: - completed push: tags: - - '*' + - "*" # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: @@ -18,7 +18,6 @@ env: CPU: "arm64" jobs: - on-failure: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' }} @@ -66,13 +65,13 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.IMAGE_NAME }} - # Set tag to latest if there is no release tag from git - # Tag the build with the current release + # Flavor auto will autmaticlly add the latest tag to the most recent image + flavor: | + latest=auto + # tags: | - type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} - type=ref,event=tag,enable={{is_default_branch}} - type=semver,pattern={{version}} - + type=ref,event=tag,enable={{!is_default_branch}} + type=semver,pattern={{version}},enable={{is_default_branch}} - name: Install just run: ./ci/scripts/install-just.sh From 00ece8d466b8114648ff330b71fdca651c0fc21a Mon Sep 17 00:00:00 2001 From: Amund Isaksen Date: Thu, 3 Oct 2024 07:25:43 +0200 Subject: [PATCH 4/5] Remove on_workflow --- .github/workflows/registry_upload.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/registry_upload.yml b/.github/workflows/registry_upload.yml index f007d0ab..753e842a 100644 --- a/.github/workflows/registry_upload.yml +++ b/.github/workflows/registry_upload.yml @@ -2,11 +2,6 @@ name: Create and publish a Docker image # Configures this workflow to run on main when testing CI is completed. on: - workflow_run: - workflows: ["CI"] - branches: [main] - types: - - completed push: tags: - "*" From 47e79e494f1993c91480c77d3c7f77c7cb25f3c7 Mon Sep 17 00:00:00 2001 From: Amund Isaksen Date: Thu, 3 Oct 2024 07:39:56 +0200 Subject: [PATCH 5/5] Add comments --- .github/workflows/registry_upload.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/registry_upload.yml b/.github/workflows/registry_upload.yml index 753e842a..7ae85714 100644 --- a/.github/workflows/registry_upload.yml +++ b/.github/workflows/registry_upload.yml @@ -65,10 +65,12 @@ jobs: # Flavor auto will autmaticlly add the latest tag to the most recent image flavor: | latest=auto - # + # type=ref will create custom tags, from whatever branch/tag that is created + # type=pep440 will only run on main branch, when there is a semantic tag added to a commit. + # pep440 is same as semver but also accept tags without the v in front. tags: | type=ref,event=tag,enable={{!is_default_branch}} - type=semver,pattern={{version}},enable={{is_default_branch}} + type=pep440,pattern={{version}},enable={{is_default_branch}} - name: Install just run: ./ci/scripts/install-just.sh