From a3a244db8cba15647781c8b55385849cde91823c Mon Sep 17 00:00:00 2001 From: yangw Date: Tue, 7 May 2024 09:58:02 +0800 Subject: [PATCH] build: add workflow to publish image to ghcr (#914) * build: add ghcr release process Signed-off-by: drivebyer * fix: env Signed-off-by: drivebyer --------- Signed-off-by: drivebyer Signed-off-by: Matt Robinson --- .github/workflows/publish-image.yaml | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/publish-image.yaml diff --git a/.github/workflows/publish-image.yaml b/.github/workflows/publish-image.yaml new file mode 100644 index 000000000..c7e1b44b5 --- /dev/null +++ b/.github/workflows/publish-image.yaml @@ -0,0 +1,46 @@ +name: Publish Image to GitHub Container Registry + +on: + push: + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + REPOSITORY: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up docker buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Env + run: | + echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Build and Push Operator image + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.TAG }} + ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest + platforms: linux/amd64,linux/arm64 \ No newline at end of file