From 6e90592bb6cde5a818d80bf8006266c545ada8a8 Mon Sep 17 00:00:00 2001 From: Marvin Javier Date: Tue, 31 Aug 2021 21:35:33 -0500 Subject: [PATCH] feat: push docker image to ghcr (#70) * Update release.yaml --- .github/workflows/release.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7f874ac..b692a74 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,3 +1,7 @@ +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + on: release name: Build jobs: @@ -106,3 +110,31 @@ jobs: EXECUTABLE_NAME: "solidfire-exporter" EXECUTABLE_PATH: "./cmd/solidfire-exporter" PACKAGE: "./cmd/solidfire-exporter/main.go" + + push_to_registry: + name: Push Docker image + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN } + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}