diff --git a/.github/workflows/container_image.yaml b/.github/workflows/container_image.yaml new file mode 100644 index 0000000..823d996 --- /dev/null +++ b/.github/workflows/container_image.yaml @@ -0,0 +1,48 @@ +name: Build Container Image + +# Controls when the workflow will run +on: + workflow_dispatch: + push: + branches: [master] + tags: [v*] + release: + types: [published] + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Get the repository's code + - name: Checkout + uses: actions/checkout@v4 + + # Generate docker tags + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/tn1ck/super-sudoku + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}