1010 tags :
1111 - v*.*.*
1212 workflow_dispatch :
13- inputs : {}
13+ inputs :
14+ version :
15+ description : ' FrankenPHP version'
16+ required : false
17+ type : string
1418 schedule :
1519 - cron : ' 0 0 * * *'
1620jobs :
1721 prepare :
1822 runs-on : ubuntu-latest
1923 outputs :
20- ref : ${{ steps.ref.outputs.ref }}
24+ ref : ${{ steps.ref.outputs.ref || (github.event_name == 'workflow_dispatch' && inputs.version) || '' }}
2125 steps :
2226 -
2327 name : Get latest release
4246 version : latest
4347 -
4448 name : Login to DockerHub
45- if : github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
49+ if : needs.prepare.outputs.ref || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
4650 uses : docker/login-action@v3
4751 with :
4852 username : ${{secrets.REGISTRY_USERNAME}}
@@ -53,27 +57,27 @@ jobs:
5357 uses : docker/bake-action@v4
5458 with :
5559 pull : true
56- load : ${{toJson(github.event_name != 'schedule' && !startsWith(github.ref, 'refs/tags/') && (github.ref != 'refs/heads/main' || github.event_name == 'pull_request'))}}
57- push : ${{toJson(github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request'))}}
60+ load : ${{toJson(!needs.prepare.outputs.ref && !startsWith(github.ref, 'refs/tags/') && (github.ref != 'refs/heads/main' || github.event_name == 'pull_request'))}}
61+ push : ${{toJson(needs.prepare.outputs.ref || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request'))}}
5862 targets : static-builder
5963 set : |
60- *.cache-from=type=gha,scope=${{github.ref}}-static-builder
64+ *.cache-from=type=gha,scope=${{needs.prepare.outputs.ref || github.ref}}-static-builder
6165 *.cache-from=type=gha,scope=refs/heads/main-static-builder
62- *.cache-to=type=gha,scope=${{github.ref}}-static-builder,ignore-error=true
66+ *.cache-to=type=gha,scope=${{needs.prepare.outputs.ref || github.ref}}-static-builder,ignore-error=true
6367 env :
6468 SHA : ${{github.sha}}
6569 VERSION : ${{ (github.ref_type == 'tag' && github.ref_name) || needs.prepare.outputs.ref || github.sha}}
6670 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6771 -
6872 name : Pull Docker image
69- if : github.event_name == 'schedule' || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
73+ if : needs.prepare.outputs.ref || startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
7074 run : docker pull dunglas/frankenphp:static-builder
7175 -
7276 name : Copy binary
7377 run : docker cp "$(docker create --name static-builder dunglas/frankenphp:static-builder):/go/src/app/dist/frankenphp-linux-x86_64" frankenphp-linux-x86_64 ; docker rm static-builder
7478 -
7579 name : Upload asset
76- if : github.event_name == 'schedule' || github.ref_type == 'tag'
80+ if : needs.prepare.outputs.ref || github.ref_type == 'tag'
7781 run : gh release upload "${{ (github.ref_type == 'tag' && github.ref_name) || needs.prepare.outputs.ref }}" frankenphp-linux-x86_64 --repo dunglas/frankenphp --clobber
7882 env :
7983 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -119,7 +123,7 @@ jobs:
119123 run : ./build-static.sh
120124 env :
121125 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122- RELEASE : ${{ (github.event_name == 'schedule' || github.ref_type == 'tag') && '1' || '' }}
126+ RELEASE : ${{ (needs.prepare.outputs.ref || github.ref_type == 'tag') && '1' || '' }}
123127 -
124128 name : Upload artifact
125129 if : github.ref_type == 'branch'
0 commit comments