From 49c3ca4bf171aa94f6edd1de54f5de01e137700d Mon Sep 17 00:00:00 2001 From: Chris Dunphy Date: Tue, 24 Dec 2024 15:08:08 -0700 Subject: [PATCH] Fix docker build and push --- .github/workflows/release.yml | 43 +++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e39090a..a75c883 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,9 @@ on: branches: - main +env: + REGISTRY: ghcr.io + jobs: build: runs-on: ubuntu-latest @@ -44,24 +47,40 @@ jobs: - name: Run lints run: task lint - publish_docker_image: runs-on: ubuntu-latest name: Build and Publish Docker image needs: build - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + steps: - - name: Build and push Docker image - uses: docker/build-push-action@v4 - with: - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - registry: docker.pkg.github.com - repository: atomicmeganerd/starfeed - tags: ${{ env.VERSION }},latest + - name: Login to Docker + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/atomicmeganerd/starfeed + tags: | + latest + ${{ env.VERSION }} + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + + tag_and_release: + runs-on: ubuntu-latest + name: Tag and create release + needs: publish_docker_image + steps: - name: Create Git tag run: git tag ${{ env.VERSION }} && git push origin ${{ env.VERSION }} env: