|
1 | | -name: Trigger new builds based on various criteria. |
| 1 | +name: Trigger new builds |
2 | 2 |
|
3 | 3 | # If any of the criteria happens, they set the trigger_build |
4 | 4 | # output variable to 'true' and the rebuild will happen. |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | workflow_dispatch: |
8 | 8 | schedule: |
9 | | - # Fridays 16:00 UTC |
10 | | - - cron: '10 16 * * 5' |
| 9 | + - cron: '10 16 * * *' |
11 | 10 |
|
12 | 11 | jobs: |
13 | 12 |
|
@@ -48,38 +47,42 @@ jobs: |
48 | 47 | echo "LOG: latest: $latest" |
49 | 48 |
|
50 | 49 | # Compare the versions (digits only), if current < latest, then we need to rebuild. |
| 50 | + result='false' |
51 | 51 | if [[ ${current//[!0-9]/} -lt ${latest//[!0-9]/} ]]; then |
52 | | - echo "result=true" >> $GITHUB_OUTPUT |
| 52 | + result='true' |
53 | 53 | echo "LOG: timezonedb to trigger image build" |
54 | 54 | fi |
| 55 | + echo "result=$result" >> $GITHUB_OUTPUT |
55 | 56 |
|
56 | 57 | # This job gets the results of all the jobs in the workflow and, |
57 | 58 | # if any of them has ended with the "trigger_build" output set, then |
58 | 59 | # will set its own (final) trigger_build output to 'true'. |
59 | | - evaluate: |
| 60 | + evaluate-results: |
60 | 61 | # Completely avoid forks and pull requests to try this job. |
61 | 62 | if: github.repository_owner == 'moodlehq' && contains(fromJson('["workflow_dispatch", "schedule"]'), github.event_name) |
62 | 63 | runs-on: ubuntu-latest |
63 | 64 | needs: [datetimedb-new-release] |
64 | 65 |
|
65 | 66 | outputs: |
66 | | - trigger_build: ${{ steps.evaluate.outputs.trigger }} |
| 67 | + trigger_build: ${{ steps.evaluate.outputs.result }} |
67 | 68 |
|
68 | 69 | steps: |
69 | 70 |
|
70 | 71 | - name: Evaluate if we have to trigger a build |
71 | 72 | id: evaluate |
72 | 73 | run: | |
73 | 74 | # 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 |
76 | 78 | echo "LOG: Final evaluation, trigger the build" |
77 | 79 | fi |
| 80 | + echo "result=$result" >> $GITHUB_OUTPUT |
78 | 81 |
|
79 | | - Build: |
| 82 | + build: |
80 | 83 | # 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] |
83 | 86 |
|
84 | 87 | # Launch the build job (as reusable workflow). |
85 | 88 | uses: ./.github/workflows/test_buildx_and_publish.yml |
|
0 commit comments