1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- # 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:
- workflow_dispatch:
- push:
- tags:
- - v*
- env:
- IMAGE_NAME: ${{ github.repository }}
- REGISTRY: ghcr.io
- jobs:
- build:
- name: Build and publish
- runs-on: ubuntu-latest
- environment: ${{ inputs.environment }}
- 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.GITHUB_TOKEN }}
- - 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 }}
|