From 5dd543616999a640245f0f4392d9c02fe2d739e2 Mon Sep 17 00:00:00 2001 From: RoboMagus Date: Wed, 25 Feb 2026 19:09:53 +0000 Subject: [PATCH] Semver tags for Docker images (#720) The main Gitea docker image is already distributed with proper semver tags, such that users can pin to e.g. the minor version and still pull in patch releases. This is something that has been lacking on the act runner images. This PR expands the docker image tag versioning strategy such that when `v0.2.13` is released the following image tags are produced: Basic: - `0` - `0.2` - `0.2.13` - `latest` DinD: - `0-dind` - `0.2-dind` - `0.2.13-dind` - `latest-dind` DinD-Rootless: - `0-dind-rootless` - `0.2-dind-rootless` - `0.2.13-dind-rootless` - `latest-dind-rootless` To verify the `docker/metadata-action` produces the expected results in a Gitea workflow environment I've executed a release workflow. Results can be seen in [this run](https://gitea.com/RoboMagus/gitea_act_runner/actions/runs/14). (Note though that as the repository name of my fork changed from `act_runner` to `gitea_act_runner` this is reflected in the produced docker tags in this test run!) --------- Co-authored-by: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Co-authored-by: Lunny Xiao Co-authored-by: techknowlogick Reviewed-on: https://gitea.com/gitea/act_runner/pulls/720 Reviewed-by: Lunny Xiao Co-authored-by: RoboMagus Co-committed-by: RoboMagus --- .gitea/workflows/release-tag.yml | 62 ++++++++++++++------------------ 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml index 2c47dcf9..1be6e0d2 100644 --- a/.gitea/workflows/release-tag.yml +++ b/.gitea/workflows/release-tag.yml @@ -39,6 +39,15 @@ jobs: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} release-image: runs-on: ubuntu-latest + strategy: + matrix: + variant: + - target: basic + tag_suffix: "" + - target: dind + tag_suffix: "-dind" + - target: dind-rootless + tag_suffix: "-dind-rootless" container: image: catthehacker/ubuntu:act-latest env: @@ -62,50 +71,33 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Get Meta - id: meta + - name: Repo Meta + id: repo_meta run: | echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT - echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT + + - name: "Docker meta" + id: docker_meta + uses: https://github.com/docker/metadata-action@v5 + with: + images: | + ${{ env.DOCKER_ORG }}/${{ steps.repo_meta.outputs.REPO_NAME }} + tags: | + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + flavor: | + latest=true + suffix=${{ matrix.variant.tag_suffix }},onlatest=true - name: Build and push uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile - target: basic + target: ${{ matrix.variant.target }} platforms: | linux/amd64 linux/arm64 push: true - tags: | - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} - - - name: Build and push dind - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - target: dind - platforms: | - linux/amd64 - linux/arm64 - push: true - tags: | - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-dind - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}-dind - - - name: Build and push dind-rootless - uses: docker/build-push-action@v6 - with: - context: . - file: ./Dockerfile - target: dind-rootless - platforms: | - linux/amd64 - linux/arm64 - push: true - tags: | - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-dind-rootless - ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}-dind-rootless + tags: ${{ steps.docker_meta.outputs.tags }}