@@ -14,15 +14,19 @@ jobs:
1414 prepare :
1515 runs-on : ubuntu-latest
1616 outputs :
17- # Only push for th commits in the main branch
18- push : true
19- # push: ${{github.ref == 'refs/heads/main' && github.event_name != 'pull_request'}}
17+ # Push only if we're committing in the main branch
18+ push : ${{toJson(github.ref == 'refs/heads/main' && github.event_name != 'pull_request')}}
2019 variants : ${{ steps.matrix.outputs.variants }}
2120 platforms : ${{ steps.matrix.outputs.platforms }}
2221 metadata : ${{ steps.matrix.outputs.metadata }}
2322 steps :
2423 - uses : actions/checkout@v3
2524
25+ - name : Set up Docker Buildx
26+ uses : docker/setup-buildx-action@v2
27+ with :
28+ version : latest
29+
2630 - name : Create variants matrix
2731 id : matrix
2832 run : |
@@ -31,15 +35,10 @@ jobs:
3135 echo "platforms=$(jq -c 'first(.target[]) | .platforms' <<< $METADATA)" >> "$GITHUB_OUTPUT"
3236 echo "metadata=$(jq -c <<< $METADATA)" >> "$GITHUB_OUTPUT"
3337 env :
34- # LATEST: '1'
38+ LATEST : ' 1' # TODO: unset this variable when releasing the first tagged version
3539 SHA : ${{github.sha}}
3640 VERSION : ${{github.ref_name}}
3741
38- - name : Show matrix
39- run : |
40- echo "variants=${{ steps.matrix.outputs.variants }}"
41- echo "platforms=${{ steps.matrix.outputs.platforms }}"
42-
4342 build :
4443 runs-on : ubuntu-latest
4544 needs :
5453 qemu : true
5554 - platform : linux/amd64
5655 qemu : false
57- race : " -race"
58- # - platform: linux/386
59- # qemu: false
56+ race : " -race" # The Go race detector is only supported on amd64
57+ - platform : linux/386
58+ qemu : false
6059 steps :
6160 - uses : actions/checkout@v3
6261
@@ -73,12 +72,12 @@ jobs:
7372 version : latest
7473
7574 - name : Login to DockerHub
76- if : needs.prepare.outputs.push
75+ if : fromJson( needs.prepare.outputs.push)
7776 uses : docker/login-action@v2
7877 with :
7978 username : ${{secrets.REGISTRY_USERNAME}}
8079 password : ${{secrets.REGISTRY_PASSWORD}}
81-
80+
8281 - name : Build
8382 id : build
8483 uses : docker/bake-action@v3
@@ -96,13 +95,13 @@ jobs:
9695 *.cache-to=type=gha,scope=${{github.ref}}-${{matrix.platform}}
9796 *.output=type=image,name=dunglas/frankenphp,push-by-digest=true,name-canonical=true,push=${{ needs.prepare.outputs.push }}
9897 env :
99- # LATEST: '1'
98+ LATEST : ' 1' # TODO: unset this variable when releasing the first tagged version
10099 SHA : ${{github.sha}}
101100 VERSION : ${{github.ref_name}}
102101
103102 # Workaround for https://github.com/actions/runner/pull/2477#issuecomment-1501003600
104103 - name : Export metadata
105- if : needs.prepare.outputs.push
104+ if : fromJson( needs.prepare.outputs.push)
106105 run : |
107106 mkdir -p /tmp/metadata/builder /tmp/metadata/runner
108107
@@ -146,7 +145,7 @@ jobs:
146145 needs :
147146 - prepare
148147 - build
149- if : needs.prepare.outputs.push
148+ if : fromJson( needs.prepare.outputs.push)
150149 strategy :
151150 fail-fast : false
152151 matrix :
0 commit comments