diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c0f4cef..bc1e4db 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,8 +2,11 @@ name: docker on: push: + branches: + - "master" + - "develop" tags: - - '*' + - 'v*' permissions: packages: write @@ -19,24 +22,27 @@ jobs: with: fetch-depth: 0 - - name: Get the tag name - run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - name: Login to GitHub Container Registry uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/autobrr/autobrr + + - name: Build and publish image id: docker_build uses: docker/build-push-action@v2 with: - push: true - tags: | - ghcr.io/autobrr/autobrr:${{ env.TAG }} - ghcr.io/autobrr/autobrr:latest - + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }}