123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- # 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 }}
|