1
1
name : Build
2
2
on :
3
3
pull_request :
4
- types : [ opened, synchronize, edited ]
4
+ types : [ opened, edited ]
5
5
push :
6
- branches : [ main ]
7
6
workflow_dispatch :
7
+ inputs :
8
+ recreate_vm :
9
+ required : true
10
+ type : string
11
+ description : " Whether to recreate the VM"
12
+ default : " false"
8
13
9
14
jobs :
10
15
configuration :
@@ -16,42 +21,48 @@ jobs:
16
21
outputs :
17
22
is_main_branch : ${{ (github.head_ref || github.ref) == 'refs/heads/main' }}
18
23
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') }}
24
29
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') }}
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') }}
33
38
workspace_feature_flags : ${{ steps.output.outputs.workspace_feature_flags }}
34
39
pr_no_diff_skip : ${{ steps.pr-diff.outputs.pr_no_diff_skip }}
35
40
steps :
36
41
- name : " Determine Branch"
37
42
id : branches
38
43
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 }}
39
50
# If the PR got edited, but no checkbox changes occurred, we don't want to run the whole build
40
51
# Therefore we set a flag and use it to skip the next jobs
41
52
- name : " Check PR diff"
42
53
id : pr-diff
54
+ if : (github.event_name == 'pull_request' && github.event.action == 'edited')
43
55
env :
44
- PR_DESC : ' ${{ github.event.pull_request.body }}'
56
+ PR_DESC : ' ${{ steps.pr-details.outputs.pr_body }}'
45
57
OLD_BODY : ' ${{ github.event.changes.body.from }}'
46
- if : (github.event_name == 'pull_request' && github.event.action == 'edited')
47
58
run : |
48
59
if ! diff <(echo "$OLD_BODY") <(echo "$PR_DESC") | grep -e '\[x\]' -e '\[X\]'; then
49
60
echo "pr_no_diff_skip=true" >> $GITHUB_OUTPUT
50
61
fi
51
62
- name : " Set outputs"
52
63
id : output
53
64
env :
54
- PR_DESC : ' ${{ github.event.pull_request.body }}'
65
+ PR_DESC : ' ${{ steps.pr-details.outputs.pr_body }}'
55
66
shell : bash
56
67
run : |
57
68
{
@@ -116,6 +127,7 @@ jobs:
116
127
infrastructure_provider : ${{ needs.configuration.outputs.preview_infra_provider }}
117
128
previewctl_hash : ${{ needs.build-previewctl.outputs.previewctl_hash }}
118
129
large_vm : ${{ needs.configuration.outputs.with_large_vm }}
130
+ recreate_vm : ${{ inputs.recreate_vm }}
119
131
120
132
build-gitpod :
121
133
name : Build Gitpod
0 commit comments