Skip to content

Commit

Permalink
WIP: github: Do pushes with push-by-digest, do a separate create step
Browse files Browse the repository at this point in the history
  • Loading branch information
mstorsjo committed Feb 27, 2024
1 parent bf17689 commit 0887587
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ jobs:
docker-build:
needs: [prepare]
runs-on: ubuntu-latest
outputs:
digest: ${{steps.build.outputs.digest}}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -99,15 +101,49 @@ jobs:
password: ${{secrets.DOCKER_PASSWORD}}
- name: Build Docker images
uses: docker/build-push-action@v5
id: build
with:
context: .
platforms: ${{matrix.platforms}}
push: false
file: ./${{matrix.file}}
load: true
tags: |
mstorsjo/llvm-mingw:test
mstorsjo/llvm-mingw:test-${{needs.prepare.outputs.TAG}}
outputs: |
type=image,name=mstorsjo/llvm-mingw,push-by-digest=true,name-canonical=true
- name: Inspect Docker images
run: |
docker images
- name: Write outputs for later steps
uses: cloudposse/github-action-matrix-outputs-write@main
id: out
with:
matrix-step-name: ${{github.job}}
matrix-key: ${{matrix.file}}
outputs: |-
digest: ${{steps.build.outputs.digest}}
docker-create:
needs: [docker-build, prepare]
runs-on: ubuntu-latest
steps:
- uses: cloudposse/github-action-matrix-outputs-read@main
id: read
with:
matrix-step-name: docker-build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
if: false
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Create final image
env:
digest: ${{fromJson(steps.read.outputs.result).digest}}
run: |
echo digest ${{needs.docker-build.outputs.digest}}
echo digest2 $digest
echo result ${{fromJson(steps.read.outputs.result).digest}}
for tag in test test-${{needs.prepare.outputs.TAG}}; do
docker buildx imagetools create --dry-run -t mstorsjo/llvm-mingw:$tag mstorsjo/llvm-mingw@${{needs.docker-build.outputs.digest}}
done

0 comments on commit 0887587

Please sign in to comment.