diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 78b8b64..e32d212 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -19,10 +19,33 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Login to ghcr.io - run: echo "${{ secrets.GHCR_PAT }}" | docker login --username ${{ github.actor }} --password-stdin ${{ env.REGISTRY }} - - name: Build and tag image - run: docker build . -t ${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}:latest - - name: Push image to ghcr.io - run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest +# - name: Login to ghcr.io +# run: echo "${{ secrets.GHCR_PAT }}" | docker login --username ${{ github.actor }} --password-stdin ${{ env.REGISTRY }} +# - name: Build and tag image +# run: docker build . -t ${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}:latest +# - name: Push image to ghcr.io +# run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GHCR_PAT }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{ version }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}