Skip to content

Commit 2a8ac52

Browse files
committed
Minor changes to the trigger workflow
- Change to (shorter) job names. - Camel case "validate". - Change schedule to happen daily 16:10 UTC. - Fix bash condition.
1 parent d9c5fa7 commit 2a8ac52

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/trigger_new_builds.yml

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
name: Trigger new builds based on various criteria.
1+
name: Trigger new builds
22

33
# If any of the criteria happens, they set the trigger_build
44
# output variable to 'true' and the rebuild will happen.
55

66
on:
77
workflow_dispatch:
88
schedule:
9-
# Fridays 16:00 UTC
10-
- cron: '10 16 * * 5'
9+
- cron: '10 16 * * *'
1110

1211
jobs:
1312

@@ -48,38 +47,42 @@ jobs:
4847
echo "LOG: latest: $latest"
4948
5049
# Compare the versions (digits only), if current < latest, then we need to rebuild.
50+
result='false'
5151
if [[ ${current//[!0-9]/} -lt ${latest//[!0-9]/} ]]; then
52-
echo "result=true" >> $GITHUB_OUTPUT
52+
result='true'
5353
echo "LOG: timezonedb to trigger image build"
5454
fi
55+
echo "result=$result" >> $GITHUB_OUTPUT
5556
5657
# This job gets the results of all the jobs in the workflow and,
5758
# if any of them has ended with the "trigger_build" output set, then
5859
# will set its own (final) trigger_build output to 'true'.
59-
evaluate:
60+
evaluate-results:
6061
# Completely avoid forks and pull requests to try this job.
6162
if: github.repository_owner == 'moodlehq' && contains(fromJson('["workflow_dispatch", "schedule"]'), github.event_name)
6263
runs-on: ubuntu-latest
6364
needs: [datetimedb-new-release]
6465

6566
outputs:
66-
trigger_build: ${{ steps.evaluate.outputs.trigger }}
67+
trigger_build: ${{ steps.evaluate.outputs.result }}
6768

6869
steps:
6970

7071
- name: Evaluate if we have to trigger a build
7172
id: evaluate
7273
run: |
7374
# Add here more conditions (ORed) when new criteria are added.
74-
if [[ ${{ needs.datetimedb-new-release.outputs.trigger_build }} ]]; then
75-
echo "trigger=true" >> $GITHUB_OUTPUT
75+
result=false
76+
if [[ "${{ needs.datetimedb-new-release.outputs.trigger_build }}" == "true" ]]; then
77+
result=true
7678
echo "LOG: Final evaluation, trigger the build"
7779
fi
80+
echo "result=$result" >> $GITHUB_OUTPUT
7881
79-
Build:
82+
build:
8083
# Only if the final workflow.outputs.trigger_build from evaluate job has decided to build.
81-
if: ${{ needs.evaluate.outputs.trigger_build }} == 'true'
82-
needs: [evaluate]
84+
if: needs.evaluate-results.outputs.trigger_build == 'true'
85+
needs: [evaluate-results]
8386

8487
# Launch the build job (as reusable workflow).
8588
uses: ./.github/workflows/test_buildx_and_publish.yml

0 commit comments

Comments
 (0)