|
73 | 73 | CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}
|
74 | 74 | CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}
|
75 | 75 | NEW: ${{ steps.check_deployment.outputs.NEW }}
|
76 |
| - BUILD: | |
77 |
| - ${{ |
78 |
| - (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && |
79 |
| - ( |
80 |
| - (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || |
81 |
| - github.event.inputs.build == 'true' |
82 |
| - ) |
83 |
| - }} |
| 76 | + BUILD: ${{ steps.build_conditionals.outputs.first_or_force_build || steps.build_conditionals.outputs.automatic_rebuild }} |
84 | 77 |
|
85 | 78 | runs-on: "ubuntu-latest"
|
86 | 79 | steps:
|
@@ -162,18 +155,14 @@ jobs:
|
162 | 155 | echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}"
|
163 | 156 | echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}"
|
164 | 157 |
|
165 |
| - - name: Print job outputs |
| 158 | + - name: Build conditionals |
| 159 | + id: build_conditionals |
166 | 160 | run: |
|
167 | 161 | set -euo pipefail
|
168 |
| - # Print all outputs of this job |
169 |
| - echo "PR_NUMBER=${{ steps.pr_info.outputs.PR_NUMBER }}" |
170 |
| - echo "PR_TITLE=${{ steps.pr_info.outputs.PR_TITLE }}" |
171 |
| - echo "PR_URL=${{ steps.pr_info.outputs.PR_URL }}" |
172 |
| - echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" |
173 |
| - echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" |
174 |
| - echo "NEW=${{ steps.check_deployment.outputs.NEW }}" |
175 |
| - echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || github.event.inputs.build == 'true') }}" |
176 |
| - echo "GITHUB_REF=${{ github.ref }}" |
| 162 | + # build if the workflow is manually triggered and the deployment doesn't exist (first build or force rebuild) |
| 163 | + echo "first_or_force_build=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || github.event.inputs.build == 'true' }}" >> $GITHUB_OUTPUT |
| 164 | + # build if the deployment alreday exist and there are changes in the files that we care about (automatic updates) |
| 165 | + echo "automatic_rebuild=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT |
177 | 166 |
|
178 | 167 | comment-pr:
|
179 | 168 | needs: [check_pr, get_info]
|
|
0 commit comments