File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ name: "Create and publish docker image"
33on :
44 release :
55 types : [published]
6+ schedule :
7+ # Run at 2:00 AM UTC on the 1st of each month
8+ - cron : ' 0 2 1 * *'
69
710permissions :
811 contents : read
1215 build :
1316 runs-on : ubuntu-latest
1417 steps :
18+ - name : Get latest release tag
19+ if : github.event_name == 'schedule'
20+ id : latest_release
21+ run : |
22+ LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
23+ echo "RELEASE_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT
24+
25+ - name : Set release tag variable
26+ id : release_tag
27+ run : |
28+ if [ "${{ github.event_name }}" == "schedule" ]; then
29+ echo "TAG=${{ steps.latest_release.outputs.RELEASE_TAG }}" >> $GITHUB_OUTPUT
30+ else
31+ echo "TAG=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
32+ fi
33+
1534 - name : Check out code
1635 uses : actions/checkout@v4
36+ with :
37+ ref : ${{ steps.release_tag.outputs.TAG }}
1738
1839 - name : Setup PHP
1940 uses : shivammathur/setup-php@v2
4970 file : docker/php/package.Dockerfile
5071 push : true
5172 platforms : linux/amd64,linux/arm64
52- tags : ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository }}:latest
73+ tags : ghcr.io/${{ github.repository }}:${{ steps.release_tag.outputs.TAG }},ghcr.io/${{ github.repository }}:latest
You can’t perform that action at this time.
0 commit comments