1- name : " Scheduled: docker"
1+ name : build/ docker
22
33on :
4- schedule :
5- - cron : ' 0 6 * * 1'
4+ workflow_call :
5+ inputs :
6+ publish :
7+ required : true
8+ type : boolean
69
710jobs :
811 lint :
912 runs-on : ubuntu-latest
1013 steps :
11- - uses : actions/checkout@v2
14+ - uses : actions/checkout@v4
1215
1316 - name : Set Swap Space
14- uses : pierotofy/set-swap-space@master
17+ uses : pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
1518 with :
1619 swap-size-gb : 12
1720
1821 - name : Run Golangci lint
19- uses : golangci/golangci-lint-action@v2
22+ uses : golangci/golangci-lint-action@v3
2023 with :
2124 version : latest
2225 args : --print-resources-usage
2326
2427 build :
28+ name : " build ${{ matrix.Dockerfile }}:${{ matrix.target }}"
2529 needs : lint
2630 strategy :
2731 fail-fast : false
2832 matrix :
29- Dockerfile : [Dockerfile]
30- suffix : [""]
31- latest : ["auto"]
32- include : []
33+ include :
34+ - Dockerfile : Dockerfile
35+ target : " final-static"
36+ suffix : " "
37+ latest : " auto"
3338 runs-on : ubuntu-latest
3439 steps :
35- - uses : actions/checkout@v2
40+ - uses : actions/checkout@v4
3641
3742 - name : Set Swap Space
38- uses : pierotofy/set-swap-space@master
43+ uses : pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
3944 with :
4045 swap-size-gb : 12
4146
4247 - name : Docker meta
4348 id : docker_meta
44- uses : docker/metadata-action@v4
49+ uses : docker/metadata-action@v5
4550 with :
4651 images : ${{ github.repository }},quay.io/${{ github.repository }}
4752 labels : |
@@ -51,30 +56,33 @@ jobs:
5156 suffix=${{ matrix.suffix }}
5257
5358 - name : Set up QEMU
54- uses : docker/setup-qemu-action@v1
59+ uses : docker/setup-qemu-action@v3
5560
5661 - name : Set up Docker Buildx
57- uses : docker/setup-buildx-action@v1
62+ uses : docker/setup-buildx-action@v3
5863
5964 - name : Login to DockerHub
60- uses : docker/login-action@v1
65+ uses : docker/login-action@v3
66+ if : ${{ inputs.publish }}
6167 with :
6268 username : ${{ secrets.DOCKERHUB_USERNAME }}
6369 password : ${{ secrets.DOCKERHUB_TOKEN }}
6470
6571 - name : Login to Quay
66- uses : docker/login-action@v1
72+ uses : docker/login-action@v3
73+ if : ${{ inputs.publish }}
6774 with :
6875 registry : quay.io
6976 username : ${{ secrets.QUAY_USERNAME }}
7077 password : ${{ secrets.QUAY_TOKEN }}
7178
72- - name : Build and push
73- uses : docker/build-push-action@v2
79+ - name : ${{ inputs.publish && ' Build and push' || 'Build' }}
80+ uses : docker/build-push-action@v5
7481 with :
7582 context : .
7683 file : ./${{ matrix.Dockerfile }}
84+ target : ${{ matrix.target }}
7785 platforms : linux/amd64,linux/arm64
78- push : ${{ github.event_name != 'pull_request' }}
86+ push : ${{ inputs.publish }}
7987 tags : ${{ steps.docker_meta.outputs.tags }}
8088 labels : ${{ steps.docker_meta.outputs.labels }}
0 commit comments