Varun Patil | 6ba08cd | 2023-11-18 13:54:52 -0800 | [diff] [blame^] | 1 | name: Publish Docker image |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | paths-ignore: |
| 8 | - '*.md' |
| 9 | - '.mailmap' |
| 10 | workflow_dispatch: |
| 11 | |
| 12 | permissions: |
| 13 | contents: read |
| 14 | packages: write |
| 15 | |
| 16 | env: |
| 17 | REGISTRY: ghcr.io |
| 18 | IMAGE_NAME: ${{ github.repository }} |
| 19 | |
| 20 | jobs: |
| 21 | publish: |
| 22 | runs-on: ubuntu-latest |
| 23 | steps: |
| 24 | - name: Checkout repository |
| 25 | uses: actions/checkout@v4 |
| 26 | with: |
| 27 | submodules: true |
| 28 | |
| 29 | - name: Login to ${{ env.REGISTRY }} |
| 30 | uses: docker/login-action@v3 |
| 31 | with: |
| 32 | registry: ${{ env.REGISTRY }} |
| 33 | username: ${{ github.actor }} |
| 34 | password: ${{ secrets.GITHUB_TOKEN }} |
| 35 | |
| 36 | - name: Extract metadata |
| 37 | id: meta |
| 38 | uses: docker/metadata-action@v5 |
| 39 | with: |
| 40 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 41 | flavor: latest=true |
| 42 | |
| 43 | - name: Build and push Docker image |
| 44 | uses: docker/build-push-action@v5 |
| 45 | with: |
| 46 | context: . |
| 47 | pull: true |
| 48 | push: true |
| 49 | tags: ${{ steps.meta.outputs.tags }} |
| 50 | labels: ${{ steps.meta.outputs.labels }} |