From 849c18de551d758fca041dab8df1154f69adc8ea Mon Sep 17 00:00:00 2001 From: kirbylink <86572636+kirbylink@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:48:59 +0100 Subject: [PATCH] GH-2285 Add Docker tags for Major and Major.Minor versions (Resolve #2282) Adding new step`Generate Docker Tags` to the `Docker` pipeline to fetch the major and minor version of the application and use it in the last step for additional docker tags --- .github/workflows/publish-release.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 8fb94d74c..f31ffdf34 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -101,6 +101,15 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: "Generate Docker Tags" + id: generate-tags + run: | + VERSION="${{ needs.github.outputs.version }}" + MAJOR=$(echo $VERSION | cut -d '.' -f 1) + MINOR=$(echo $VERSION | cut -d '.' -f 2) + + echo "::set-output name=tags::dzikoysk/reposilite:latest,dzikoysk/reposilite:${VERSION},dzikoysk/reposilite:${MAJOR},dzikoysk/reposilite:${MAJOR}.${MINOR},ghcr.io/dzikoysk/reposilite:latest,ghcr.io/dzikoysk/reposilite:${VERSION},ghcr.io/dzikoysk/reposilite:${MAJOR},ghcr.io/dzikoysk/reposilite:${MAJOR}.${MINOR}" + - name: "Build and push" id: docker_build uses: docker/build-push-action@v3 @@ -108,8 +117,4 @@ jobs: context: . platforms: "linux/amd64,linux/arm64" push: true - tags: | - dzikoysk/reposilite:latest - dzikoysk/reposilite:${{ needs.github.outputs.version }} - ghcr.io/dzikoysk/reposilite:latest - ghcr.io/dzikoysk/reposilite:${{ needs.github.outputs.version }} + tags: ${{ steps.generate-tags.outputs.tags }}