From a5e9529e611161dc339b2c28f847abbe5c2dbb2c Mon Sep 17 00:00:00 2001 From: Josh Berkus Date: Fri, 28 Apr 2023 16:34:25 -0700 Subject: [PATCH] Add new GH workflow to publish images With each published release. Signed-off-by: Josh Berkus --- .github/workflows/release-image.yml | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/release-image.yml diff --git a/.github/workflows/release-image.yml b/.github/workflows/release-image.yml new file mode 100644 index 0000000..36de8f1 --- /dev/null +++ b/.github/workflows/release-image.yml @@ -0,0 +1,36 @@ +name: Image On Release + +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + push_to_registry: + name: Push Docker image to GHCR + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}