11name : Build
22on :
33 pull_request :
4- types : [ opened, synchronize, edited ]
4+ types : [ opened, edited ]
55 push :
6- branches : [ main ]
76 workflow_dispatch :
7+ inputs :
8+ recreate_vm :
9+ required : true
10+ type : string
11+ description : " Whether to recreate the VM"
12+ default : " false"
813
914jobs :
1015 configuration :
@@ -16,42 +21,48 @@ jobs:
1621 outputs :
1722 is_main_branch : ${{ (github.head_ref || github.ref) == 'refs/heads/main' }}
1823 version : ${{ steps.branches.outputs.sanitized-branch-name }}-gha.${{github.run_number}}
19- with_github_actions : ${{ contains(github.event.pull_request.body , '[x] /werft with-github-actions') }}
20- preview_enable : ${{ contains(github.event.pull_request.body , '[x] /werft with-preview') }}
21- preview_infra_provider : ${{ contains(github.event.pull_request.body , '[X] /werft with-gce-vm') && 'gce' || 'harvester' }}
22- build_no_cache : ${{ contains(github.event.pull_request.body , '[x] leeway-no-cache') }}
23- build_no_test : ${{ contains(github.event.pull_request.body , '[x] /werft no-test') }}
24+ with_github_actions : ${{ contains( steps.pr-details.outputs.pr_body , '[x] /werft with-github-actions') }}
25+ preview_enable : ${{ contains( steps.pr-details.outputs.pr_body , '[x] /werft with-preview') }}
26+ preview_infra_provider : ${{ contains( steps.pr-details.outputs.pr_body , '[X] /werft with-gce-vm') && 'gce' || 'harvester' }}
27+ build_no_cache : ${{ contains( steps.pr-details.outputs.pr_body , '[x] leeway-no-cache') }}
28+ build_no_test : ${{ contains( steps.pr-details.outputs.pr_body , '[x] /werft no-test') }}
2429 build_leeway_target : ${{ steps.output.outputs.build_leeway_target }}
25- with_large_vm : ${{ contains(github.event.pull_request.body , '[X] /werft with-large-vm') }}
26- publish_to_npm : ${{ contains(github.event.pull_request.body , '[X] /werft publish-to-npm') }}
27- publish_to_jbmp : ${{ contains(github.event.pull_request.body , '[X] /werft publish-to-jb-marketplace') }}
28- with_ws_manager_mk2 : ${{ contains(github.event.pull_request.body , '[X] with-ws-manager-mk2') }}
29- with_dedicated_emulation : ${{ contains(github.event.pull_request.body , '[X] with-dedicated-emulation') }}
30- with_ee_license : ${{ contains(github.event.pull_request.body , '[X] with-ee-license') }}
31- with_slow_database : ${{ contains(github.event.pull_request.body , '[X] with-slow-database') }}
32- analytics : ${{ contains(github.event.pull_request.body , '[X] analytics') }}
33- workspace_feature_flags : ${{ steps.output.outputs.workspace_feature_flags }}
30+ with_large_vm : ${{ contains( steps.pr-details.outputs.pr_body , '[X] /werft with-large-vm') }}
31+ publish_to_npm : ${{ contains( steps.pr-details.outputs.pr_body , '[X] /werft publish-to-npm') }}
32+ publish_to_jbmp : ${{ contains( steps.pr-details.outputs.pr_body , '[X] /werft publish-to-jb-marketplace') }}
33+ with_ws_manager_mk2 : ${{ contains( steps.pr-details.outputs.pr_body , '[X] with-ws-manager-mk2') }}
34+ with_dedicated_emulation : ${{ contains( steps.pr-details.outputs.pr_body , '[X] with-dedicated-emulation') }}
35+ with_ee_license : ${{ contains( steps.pr-details.outputs.pr_body , '[X] with-ee-license') }}
36+ with_slow_database : ${{ contains( steps.pr-details.outputs.pr_body , '[X] with-slow-database') }}
37+ analytics : ${{ contains( steps.pr-details.outputs.pr_body , '[X] analytics') }}
38+ workspace_feature_flags : ${{ steps.output.outputs.workspace_feature_flags }}
3439 pr_no_diff_skip : ${{ steps.pr-diff.outputs.pr_no_diff_skip }}
3540 steps :
3641 - name : " Determine Branch"
3742 id : branches
3843 uses : transferwise/sanitize-branch-name@v1
44+ # Since we trigger this worklow on other event types, besides pull_request
45+ # We use this action to help us get the pr body, as it's not included in push/workflow_dispatch events
46+ -
uses :
8BitJonny/[email protected] 47+ id : pr-details
48+ with :
49+ sha : ${{ github.event.pull_request.head.sha }}
3950 # If the PR got edited, but no checkbox changes occurred, we don't want to run the whole build
4051 # Therefore we set a flag and use it to skip the next jobs
4152 - name : " Check PR diff"
4253 id : pr-diff
54+ if : (github.event_name == 'pull_request' && github.event.action == 'edited')
4355 env :
44- PR_DESC : ' ${{ github.event.pull_request.body }}'
56+ PR_DESC : ' ${{ steps.pr-details.outputs.pr_body }}'
4557 OLD_BODY : ' ${{ github.event.changes.body.from }}'
46- if : (github.event_name == 'pull_request' && github.event.action == 'edited')
4758 run : |
4859 if ! diff <(echo "$OLD_BODY") <(echo "$PR_DESC") | grep -e '\[x\]' -e '\[X\]'; then
4960 echo "pr_no_diff_skip=true" >> $GITHUB_OUTPUT
5061 fi
5162 - name : " Set outputs"
5263 id : output
5364 env :
54- PR_DESC : ' ${{ github.event.pull_request.body }}'
65+ PR_DESC : ' ${{ steps.pr-details.outputs.pr_body }}'
5566 shell : bash
5667 run : |
5768 {
@@ -116,6 +127,7 @@ jobs:
116127 infrastructure_provider : ${{ needs.configuration.outputs.preview_infra_provider }}
117128 previewctl_hash : ${{ needs.build-previewctl.outputs.previewctl_hash }}
118129 large_vm : ${{ needs.configuration.outputs.with_large_vm }}
130+ recreate_vm : ${{ inputs.recreate_vm }}
119131
120132 build-gitpod :
121133 name : Build Gitpod
0 commit comments