diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0cabf3..d92c3cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,11 +34,35 @@ jobs: docker-build: runs-on: ubuntu-latest needs: python-checks + permissions: + contents: read + packages: write steps: - name: Check out repository uses: actions/checkout@v4 - - name: Build Docker image - run: docker build . --tag github-notifications-rss:test + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + if: ${{ github.event_name != 'pull_request' }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=sha + type=raw,value=latest,enable={{is_default_branch}} + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}