Skip to content

Commit

Permalink
issue(#3): fix push ghcr.io failed issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lispking committed Jan 17, 2024
1 parent d8d237d commit 0ca99c8
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
push:
tags:
- v[0-9]+.*

permissions:
contents: read
packages: write
Expand Down Expand Up @@ -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
Expand All @@ -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 }}"

0 comments on commit 0ca99c8

Please sign in to comment.