# Build and publish to GitHub Container Registry # # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action name: Build Docker image on: push: branches: - develop tags: - v* env: IMAGE_NAME: ${{ github.repository }} REGISTRY: ghcr.io jobs: build: name: Build and publish runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@v4 - name: Log in to registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GH_PAT }} - name: Extract image metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push image uses: docker/build-push-action@v5 with: labels: ${{ steps.meta.outputs.labels }} push: true tags: ${{ steps.meta.outputs.tags }} notify: name: Send Discord workflow notification runs-on: ubuntu-latest needs: build steps: - name: Send notification uses: annybs/action-notify-discord@v1 if: ${{ always() }} with: repository: ${{ github.repository }} result: ${{ needs.build.result }} run-id: ${{ github.run_id }} run-number: ${{ github.run_number }} webhook-url: ${{ secrets.DISCORD_WEBHOOK }} workflow: ${{ github.workflow }}