Skip to content

Commit

Permalink
testing distribute reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Feb 15, 2025
1 parent 48c8709 commit 24f7e39
Showing 1 changed file with 28 additions and 71 deletions.
99 changes: 28 additions & 71 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,76 +18,33 @@ on:
branches:
- 'master'

env:
DOCKERHUB_SLUG: crazymax/7zip
GHCR_SLUG: ghcr.io/crazy-max/7zip

jobs:
build:
runs-on: ubuntu-latest
permissions:
# same as global permissions
contents: read
# required to push to GHCR
packages: write
steps:
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_SLUG }}
${{ env.GHCR_SLUG }}
tags: |
type=match,pattern=(.*)-r,group=1
type=ref,event=pr
type=edge
labels: |
org.opencontainers.image.title=7-Zip
org.opencontainers.image.description=File archiver with a high compression ratio
org.opencontainers.image.vendor=CrazyMax
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build
uses: docker/bake-action@v6
with:
files: |
./docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
targets: image-all
push: ${{ github.event_name != 'pull_request' }}
-
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
-
name: Inspect image
if: github.event_name != 'pull_request'
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker pull ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
uses: crazy-max/docker-bake-action/reusable/distribute.yml@distribute-workflow
strategy:
fail-fast: false
matrix:
include:
- image: crazymax/7zip
login-registry: docker.io
login-username: crazymax
login-secret-key: DOCKER_PASSWORD
- image: ghcr.io/crazy-max/7zip
login-registry: ghcr.io
login-username: ${{ github.repository_owner }}
login-secret-key: GITHUB_TOKEN
with:
target: image-all
push: ${{ github.event_name != 'pull_request' }}
meta-image: ${{ matrix.image }}
meta-tags: |
type=match,pattern=(.*)-r,group=1
type=ref,event=pr
type=edge
meta-labels: |
org.opencontainers.image.title=7-Zip
org.opencontainers.image.description=File archiver with a high compression ratio
org.opencontainers.image.vendor=CrazyMax
login-username: ${{ matrix.image }}
secrets:
login-password: ${{ secrets[matrix.login-secret-key] }}

0 comments on commit 24f7e39

Please sign in to comment.