Skip to content

Commit c06e9fe

Browse files
committed
Added step for specific checkout of Git Ref for scheduled tasks
1 parent 5bf316a commit c06e9fe

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

.github/workflows/action_publish-images-beta.yml

+13
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,23 @@ on:
88
- cron: '25 8 * * 1'
99

1010
jobs:
11+
get-latest-beta-release:
12+
runs-on: ubuntu-24.04
13+
outputs:
14+
release_tag: ${{ steps.get_latest_beta.outputs.release_tag }}
15+
steps:
16+
- name: Get Latest Beta Release
17+
id: get_latest_beta
18+
run: |
19+
LATEST_BETA=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases | jq -r '[.[] | select(.prerelease == true)][0].tag_name')
20+
echo "release_tag=${LATEST_BETA}" >> $GITHUB_OUTPUT
21+
1122
build-beta-images:
23+
needs: get-latest-beta-release
1224
uses: ./.github/workflows/service_docker-build-and-publish.yml
1325
with:
1426
registry-repositories: "docker.io/serversideup/php,ghcr.io/serversideup/php"
1527
tag-prefix: "beta"
1628
release-type: "testing"
29+
ref: ${{ needs.get-latest-beta-release.outputs.release_tag }}
1730
secrets: inherit

.github/workflows/action_publish-images-production.yml

+13
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,23 @@ on:
88
- cron: '0 8 * * 2'
99

1010
jobs:
11+
get-latest-release:
12+
runs-on: ubuntu-24.04
13+
outputs:
14+
release_tag: ${{ steps.get_latest_release.outputs.release_tag }}
15+
steps:
16+
- name: Get Latest Release
17+
id: get_latest_release
18+
run: |
19+
LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
20+
echo "release_tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
21+
1122
build-production-images:
23+
needs: get-latest-release
1224
uses: ./.github/workflows/service_docker-build-and-publish.yml
1325
with:
1426
registry-repositories: "docker.io/serversideup/php,ghcr.io/serversideup/php"
1527
tag-prefix: ''
1628
release-type: "latest"
29+
ref: ${{ needs.get-latest-release.outputs.release_tag }}
1730
secrets: inherit

.github/workflows/service_docker-build-and-publish.yml

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ on:
3131
type: boolean
3232
default: true
3333
description: 'Whether to push the images to the registry.'
34+
ref:
35+
type: string
36+
default: ${{ github.ref }}
37+
description: 'The git ref to checkout (branch, tag, or commit SHA)'
3438

3539
jobs:
3640
setup-matrix:
@@ -40,6 +44,8 @@ jobs:
4044
steps:
4145
- name: Check out code
4246
uses: actions/checkout@v4
47+
with:
48+
ref: ${{ inputs.ref }}
4349

4450
- name: Prepare PHP versions for the matrix. 😎
4551
run: |
@@ -84,6 +90,8 @@ jobs:
8490
steps:
8591
- name: Check out code.
8692
uses: actions/checkout@v4
93+
with:
94+
ref: ${{ inputs.ref }}
8795

8896
- name: Download PHP Versions file
8997
uses: actions/download-artifact@v4

0 commit comments

Comments
 (0)