From c371b68ba7c39b02cbf810f6078cd685b02e7f80 Mon Sep 17 00:00:00 2001 From: Kirill Ryabov Date: Mon, 26 May 2025 13:14:28 +0300 Subject: [PATCH] MSP-5494 add github actions ci to build & publish docker image --- .github/workflows/publish-ghcr.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml index a6b4236..ba1e511 100644 --- a/.github/workflows/publish-ghcr.yml +++ b/.github/workflows/publish-ghcr.yml @@ -1,7 +1,9 @@ name: Create and publish a Docker image on: - push + push: + tags: + - 'v*' env: REGISTRY: ghcr.io @@ -19,10 +21,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Read version from file + - name: Get version from tag id: version_reader run: | - VERSION=$(cat .version) + VERSION=${GITHUB_REF_NAME#v} echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -43,7 +45,7 @@ jobs: push: true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }} - ${{ github.ref == 'refs/heads/main' && format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) || ''}} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest labels: | org.opencontainers.image.title=${{ env.IMAGE_NAME }} org.opencontainers.image.version=${{ steps.version_reader.outputs.version }} @@ -55,4 +57,4 @@ jobs: with: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true + push-to-registry: true \ No newline at end of file