Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jul 16, 2023
1 parent 78bb6e3 commit 00adca4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ jobs:
prepare:
runs-on: ubuntu-latest
outputs:
# Only push for th commits in the main branch
push: true
#push: ${{github.ref == 'refs/heads/main' && github.event_name != 'pull_request'}}
# Push only if we're committing in the main branch
push: ${{toJson(github.ref == 'refs/heads/main' && github.event_name != 'pull_request')}}
variants: ${{ steps.matrix.outputs.variants }}
platforms: ${{ steps.matrix.outputs.platforms }}
metadata: ${{ steps.matrix.outputs.metadata }}
steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: latest

- name: Create variants matrix
id: matrix
run: |
Expand All @@ -31,15 +35,10 @@ jobs:
echo "platforms=$(jq -c 'first(.target[]) | .platforms' <<< $METADATA)" >> "$GITHUB_OUTPUT"
echo "metadata=$(jq -c <<< $METADATA)" >> "$GITHUB_OUTPUT"
env:
#LATEST: '1'
LATEST: '1' # TODO: unset this variable when releasing the first tagged version
SHA: ${{github.sha}}
VERSION: ${{github.ref_name}}

- name: Show matrix
run: |
echo "variants=${{ steps.matrix.outputs.variants }}"
echo "platforms=${{ steps.matrix.outputs.platforms }}"
build:
runs-on: ubuntu-latest
needs:
Expand All @@ -54,9 +53,9 @@ jobs:
qemu: true
- platform: linux/amd64
qemu: false
race: "-race"
#- platform: linux/386
# qemu: false
race: "-race" # The Go race detector is only supported on amd64
- platform: linux/386
qemu: false
steps:
- uses: actions/checkout@v3

Expand All @@ -73,12 +72,12 @@ jobs:
version: latest

- name: Login to DockerHub
if: needs.prepare.outputs.push
if: fromJson(needs.prepare.outputs.push)
uses: docker/login-action@v2
with:
username: ${{secrets.REGISTRY_USERNAME}}
password: ${{secrets.REGISTRY_PASSWORD}}

- name: Build
id: build
uses: docker/bake-action@v3
Expand All @@ -96,13 +95,13 @@ jobs:
*.cache-to=type=gha,scope=${{github.ref}}-${{matrix.platform}}
*.output=type=image,name=dunglas/frankenphp,push-by-digest=true,name-canonical=true,push=${{ needs.prepare.outputs.push }}
env:
#LATEST: '1'
LATEST: '1' # TODO: unset this variable when releasing the first tagged version
SHA: ${{github.sha}}
VERSION: ${{github.ref_name}}

# Workaround for https://github.com/actions/runner/pull/2477#issuecomment-1501003600
- name: Export metadata
if: needs.prepare.outputs.push
if: fromJson(needs.prepare.outputs.push)
run: |
mkdir -p /tmp/metadata/builder /tmp/metadata/runner
Expand All @@ -115,6 +114,7 @@ jobs:
METADATA: ${{steps.build.outputs.metadata}}

- name: Upload runner metadata
if: fromJson(needs.prepare.outputs.push)
uses: actions/upload-artifact@v3
with:
name: metadata-builder-${{matrix.variant}}
Expand All @@ -123,6 +123,7 @@ jobs:
retention-days: 1

- name: Upload runner metadata
if: fromJson(needs.prepare.outputs.push)
uses: actions/upload-artifact@v3
with:
name: metadata-runner-${{matrix.variant}}
Expand All @@ -146,7 +147,7 @@ jobs:
needs:
- prepare
- build
if: needs.prepare.outputs.push
if: fromJson(needs.prepare.outputs.push)
strategy:
fail-fast: false
matrix:
Expand Down
6 changes: 3 additions & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ target "default" {
target = tgt
platforms = [
"linux/amd64",
#"linux/386",
#"linux/arm/v6",
#"linux/arm/v7",
"linux/386",
"linux/arm/v6",
"linux/arm/v7",
"linux/arm64",
]
tags = distinct(flatten([
Expand Down

0 comments on commit 00adca4

Please sign in to comment.