@@ -13,94 +13,120 @@ env:
13
13
VERSION : ${{ secrets.VERSION }}
14
14
BRANCH_PREFIX : " release/v"
15
15
ACTIONS_ALLOW_UNSECURE_COMMANDS : true # TODO: only needed until act supports the new way
16
+ DEFAULT_BRANCH : main
16
17
17
18
jobs :
18
19
release :
19
20
runs-on : ubuntu-latest
20
21
steps :
21
22
- if : ${{ github.event.milestone != null && github.event.milestone.title != null }}
22
23
name : set-milestone-version
23
- run : echo "::set-env name=VERSION::$(sed "s/^v//" <<< "${{ github.event.milestone.title }}")"
24
+ run : |
25
+ echo "::set-env name=VERSION::$(sed "s/^v//" <<< "${{ github.event.milestone.title }}")"
26
+ echo "::set-env name=PR_MILESTONE_LINK::-M ${{ github.event.milestone.title }}"
24
27
- if : ${{ github.event.inputs != null && github.event.inputs.version != null }}
25
28
name : set-input-version
26
29
run : echo "::set-env name=VERSION::${{ github.event.inputs.version }}"
27
30
- name : check-version
28
31
run : ' if [[ ! "${{ env.VERSION }}" =~ ^([0-9]+\.[0-9]+\.[0-9]+.*)$ ]]; then echo "The version is not valid: ${{ env.VERSION }}"; exit 1; fi'
29
32
- name : set-github-token
30
33
run : echo "::set-env name=GITHUB_TOKEN::${{ secrets.GITHUB_TOKEN }}"
31
- - if : ${{ env.GITHUB_TOKEN && env.VERSION }}
34
+ # Set host ip to env variable to be uside within container actions
35
+ - name : set-host-ip
36
+ run : echo "::set-env name=_HOST_IP::$(hostname -I | cut -d ' ' -f 1)"
37
+ # Fix git version for act if github token is provided
38
+ - if : ${{ env.GITHUB_ACTOR == 'nektos/act' && env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
39
+ name : install-latest-git
40
+ run : |
41
+ # Required for local checkout
42
+ apt-get update
43
+ apt-get install -y git
44
+ - if : ${{ env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
32
45
name : create-release-branch
33
46
uses :
peterjgrainger/[email protected]
34
47
env :
35
48
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
36
49
with :
37
50
branch : " ${{ env.BRANCH_PREFIX }}${{ env.VERSION }}"
38
- - if : ${{ ! env.GITHUB_TOKEN }}
51
+ - if : ${{ ! ( env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '') }}
39
52
uses : actions/checkout@v2
40
- - if : ${{ env.GITHUB_TOKEN }}
53
+ - if : ${{ env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
41
54
uses : actions/checkout@v2
42
55
with :
43
56
fetch-depth : 0
44
57
ref : ${{ env.BRANCH_PREFIX }}${{ env.VERSION }}
58
+ token : ${{ env.GITHUB_TOKEN }}
59
+ env :
60
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45
61
- name : run-component-builds
46
62
uses : ./.github/actions/build-environment
47
63
with :
48
64
build_args : --make --force --version=${{ env.VERSION }}
65
+ env :
66
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49
67
- name : run-linting-and-style-checks
50
68
uses : ./.github/actions/build-environment
51
69
with :
52
70
build_args : --check --force --version=${{ env.VERSION }}
71
+ env :
72
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53
73
- name : run-component-tests
54
74
uses : ./.github/actions/build-environment
55
75
with :
56
76
build_args : --test --force --test-marker=slow --version=${{ env.VERSION }}
77
+ env :
78
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
57
79
- name : release-components
58
80
uses : ./.github/actions/build-environment
59
81
env :
60
82
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61
83
PYPI_TOKEN : ${{ secrets.PYPI_TOKEN }}
62
84
PYPI_REPOSITORY : ${{ secrets.PYPI_REPOSITORY }}
63
85
with :
64
- build_args : --release --force --version=${{ env.VERSION }}
86
+ build_args : --release --force --version=${{ env.VERSION }}
65
87
container_registry_url : ${{ secrets.CONTAINER_REGISTRY_URL }}
66
88
container_registry_username : ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
67
89
container_registry_password : ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
68
- # Optional: do automatic changes to source code artefacts required for release
69
- - if : ${{ env.GITHUB_TOKEN }}
70
- name : update-repository
90
+ - if : ${{ env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
91
+ name : push-changes
71
92
uses : stefanzweifel/git-auto-commit-action@v4
72
93
with :
73
94
branch : ${{ env.BRANCH_PREFIX }}${{ env.VERSION }}
74
95
commit_user_name : Release Bot
75
96
commit_user_email :
[email protected]
76
97
commit_message : Apply automatic release changes for v${{ env.VERSION }}
77
98
tagging_message : v${{ env.VERSION }}
78
- - if : ${{ env.GITHUB_TOKEN }}
79
- name : pull-request
80
- uses : repo-sync/pull-request@v2
81
- with :
82
- source_branch : ${{ env.BRANCH_PREFIX }}${{ env.VERSION }}
83
- destination_branch : " main"
84
- pr_title : Finalize release for version ${{ env.VERSION }}
85
- pr_body : " Automated pull request for release version ${{ env.VERSION }}"
86
- pr_draft : false
87
- pr_allow_empty : true
88
- pr_label : " skip changelog"
89
- # only works if it exist: pr_milestone: v${{ env.VERSION }}
90
- github_token : ${{ secrets.GITHUB_TOKEN }}
99
+ skip_dirty_check : true
100
+ commit_options : " --allow-empty"
101
+ - if : ${{ env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
102
+ name : create-pull-request
103
+ shell : bash
104
+ run : |
105
+ # Stops script execution if a command has an error
106
+ set -e
107
+ curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.2
108
+ # TODO: Milestone link currently does not work with closed milestones: ${{ env.PR_MILESTONE_LINK }} (problem with hub cli)
109
+ bin/hub pull-request -b ${{ env.DEFAULT_BRANCH }} -h ${{ env.BRANCH_PREFIX }}${{ env.VERSION }} --no-edit -m "Finalize release for version ${{ env.VERSION }}" -m "Automated pull request for release version ${{ env.VERSION }}" -l "skip changelog" || true
110
+ rm bin/hub
111
+ env :
112
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
91
113
# Fix of release drafter to allow different events to trigger the release
92
- - if : ${{ env.GITHUB_TOKEN }}
114
+ # TODO: currently does not work with act
115
+ - if : ${{ env.GITHUB_ACTOR == 'nektos/act' && env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
116
+ name : no-relese-drafter-support
117
+ run : echo "The release drafter currently does not work with act, please create the release from the Github UI."
118
+ - if : ${{ env.GITHUB_ACTOR != 'nektos/act' && env.GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
93
119
name : checkout-fixed-release-drafter
94
120
uses : actions/checkout@v2
95
121
with :
96
122
repository : ml-tooling/release-drafter
97
- path : ./.github/ actions/release-drafter
98
- - if : ${{ env.GITHUB_TOKEN }}
123
+ path : ./.git/cloned- actions/release-drafter
124
+ - if : ${{ env.GITHUB_ACTOR != 'nektos/act' && env. GITHUB_TOKEN != null && env.GITHUB_TOKEN != '' }}
99
125
name : create-release-draft
100
- uses : ./.github/ actions/release-drafter
126
+ uses : ./.git/cloned- actions/release-drafter
101
127
with :
102
128
version : ${{ env.VERSION }}
103
129
tag : v${{ env.VERSION }}
104
130
env :
105
131
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
106
- # Optional: upload release assets via actions/upload-release-asset@v1
132
+ # Optional: upload release assets via actions/upload-release-asset@v1 and via upload_url from release drafter
0 commit comments