Skip to content

Commit

Permalink
fix-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Till0196 committed Nov 12, 2024
1 parent 6ecacb2 commit f7a7ddf
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:

name: CI

env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository }}

jobs:
build-image:
name: Build and push image
Expand Down Expand Up @@ -42,11 +45,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,prefix=pr-,suffix=,event=pr
type=sha
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
images: ${{ env.REGISTRY_IMAGE }}

- name: Set up Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -63,16 +62,15 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
outputs: type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true
platforms: ${{ matrix.platform }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha
cache-to: type=gha,mode=max

Expand All @@ -91,6 +89,7 @@ jobs:
retention-days: 1

merge:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs:
- build-image
Expand All @@ -109,7 +108,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=ref,prefix=pr-,suffix=,event=pr
type=sha
Expand All @@ -126,8 +125,8 @@ jobs:
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

0 comments on commit f7a7ddf

Please sign in to comment.