diff --git a/.github/actions/tag.yml b/.github/actions/tag.yml new file mode 100644 index 0000000..f606f4f --- /dev/null +++ b/.github/actions/tag.yml @@ -0,0 +1,21 @@ +name: Tag Docker image +description: Tag an existing Docker image on GHCR with an additional tag + +inputs: + repo: + description: Repository of the image to tag + default: ghcr.io/${{ github.repository }} + required: false + source: + description: The source tag to use + required: true + target: + description: The target tag to create + required: true + +runs: + using: "composite" + steps: + - name: tag + shell: bash + run: docker buildx imagetools create --tag ${{ inputs.repo }}:${{ inputs.target }} ${{ inputs.repo }}:${{ inputs.source }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0f2063..70671e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,6 @@ on: env: UV_VERSION: 0.8.14 - GHCR_IMAGE_REPOSITORY: ghcr.io/${{ github.repository }} PLATFORMS: linux/amd64,linux/arm64/v8 jobs: @@ -28,7 +27,8 @@ jobs: - variant: trixie is_default_variant: true env: - GIT_SHA_TAG: ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ github.sha }}-${{ matrix.python }}-${{ matrix.variant }} + GIT_SHA_TAG: ${{ github.sha }}-${{ matrix.python }}-${{ matrix.variant }} + steps: - uses: actions/checkout@v4.1.4 - uses: docker/login-action@v3.1.0 @@ -38,16 +38,28 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: tag ${{ matrix.python }}-${{ matrix.variant }} - run: docker buildx imagetools create --tag ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ matrix.python }}-${{ matrix.variant }} $GIT_SHA_TAG + uses: ./.github/actions/tag + with: + source: ${{ env.GIT_SHA_TAG }} + target: ${{ matrix.python }}-${{ matrix.variant }} - if: matrix.is_default_variant - name: tag for default variant (${{ matrix.python }}) - run: docker buildx imagetools create --tag ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ matrix.python }} $GIT_SHA_TAG + name: tag ${{ matrix.python }} (default variant) + uses: ./.github/actions/tag + with: + source: ${{ env.GIT_SHA_TAG }} + target: ${{ matrix.python }} - if: matrix.is_default_python - name: tag for default python (${{ matrix.variant }}) - run: docker buildx imagetools create --tag ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ matrix.variant }} $GIT_SHA_TAG + name: tag ${{ matrix.variant }} (default python) + uses: ./.github/actions/tag + with: + source: ${{ env.GIT_SHA_TAG }} + target: ${{ matrix.variant }} - if: matrix.is_default_python && matrix.is_default_variant - name: tag for default python and variant (latest) - run: docker buildx imagetools create --tag ${{ env.GHCR_IMAGE_REPOSITORY }}:latest $GIT_SHA_TAG + name: tag latest (default python and variant) + uses: ./.github/actions/tag + with: + source: ${{ env.GIT_SHA_TAG }} + target: latest