From 0ca99c8aebf202e7fd838d7b79b10fe0e2d0705d Mon Sep 17 00:00:00 2001 From: lispking Date: Thu, 18 Jan 2024 01:01:13 +0800 Subject: [PATCH] issue(#3): fix push ghcr.io failed issue --- .github/workflows/push-image.yml | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/push-image.yml b/.github/workflows/push-image.yml index 64d9cd0..ec1c628 100644 --- a/.github/workflows/push-image.yml +++ b/.github/workflows/push-image.yml @@ -9,7 +9,7 @@ on: push: tags: - v[0-9]+.* - + permissions: contents: read packages: write @@ -43,10 +43,7 @@ jobs: pack builder create builder --config builder.toml - name: Set environment variable - run: echo "IMAGE_NAME=ghcr.io/amp-buildpacks/leo-builder" >> $GITHUB_ENV - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + run: echo "IMAGE_NAME=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -61,14 +58,13 @@ jobs: with: images: ${{ env.IMAGE_NAME }} - - name: Build and push by digest - id: build - uses: docker/build-push-action@v5 - with: - context: . - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true - provenance: false - cache-from: type=gha - cache-to: type=gha + - name: Push To ghcr.io + run: | + registry_uri="ghcr.io" + registry_repo="${{ github.repository }}" + + docker tag builder "${registry_uri}/${registry_repo}:latest" + docker tag builder "${registry_uri}/${registry_repo}:${{ steps.event.outputs.tag }}" + + docker push "${registry_uri}/${registry_repo}:latest" + docker push "${registry_uri}/${registry_repo}:${{ steps.event.outputs.tag }}"