From 55a85c51ea497562adba56e5f47284983d327fbe Mon Sep 17 00:00:00 2001 From: Tony Grosinger Date: Sat, 23 Jul 2022 08:50:48 -0700 Subject: [PATCH] Add container build and publish to ghcr.io --- .github/workflows/docker-publish.yaml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/docker-publish.yaml diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml new file mode 100644 index 0000000..9a659b9 --- /dev/null +++ b/.github/workflows/docker-publish.yaml @@ -0,0 +1,49 @@ +name: Docker + +on: + push: + tags: ["*.*.*"] + +env: + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Retrieve tag name + id: tag + run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} + + - name: Setup QEMU + uses: docker/setup-qemu-action@v2 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + + - name: Log into registry ghcr.io + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v3 + with: + tags: ${{ steps.tag.outputs.TAG }} + platforms: linux/amd64,linux/arm64 + push: true + labels: ${{ steps.meta.outputs.labels }}