2
2
name : Release new binary version manually
3
3
4
4
on :
5
- # push:
6
- # branches: [ main ]
7
- # pull_request:
8
- # branches: [ main ]
9
5
workflow_dispatch :
10
6
11
7
jobs :
8
+ changelog-and-preparations :
9
+ runs-on : ubuntu-latest
10
+ permissions :
11
+ contents : write
12
+ pull-requests : write
13
+ steps :
14
+
15
+ - uses : actions/checkout@v4
16
+ with :
17
+ ref : ${{ github.head_ref }}
18
+ token : ${{ secrets.ZOWE_ROBOT_TOKEN }}
19
+
20
+ - uses : ./.github/actions/setup
21
+
22
+ - name : Fetch Gradle properties
23
+ id : properties
24
+ shell : bash
25
+ run : |
26
+ PROPERTIES="$(./gradlew properties --console=plain -q)"
27
+ VERSION_FULL="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
28
+ CURR_COMMIT="$(git rev-parse HEAD)"
29
+
30
+ echo "versionSemVer: $VERSION_FULL"
31
+ echo "currCommit: $CURR_COMMIT"
32
+
33
+ echo "versionSemVer=$VERSION_FULL" >> $GITHUB_OUTPUT
34
+ echo "currCommit=$CURR_COMMIT" >> $GITHUB_OUTPUT
35
+
36
+ - name : Prepare changelog
37
+ shell : bash
38
+ run : ./gradlew patchChangelog
39
+
40
+ - name : Prepare release notes
41
+ id : release_notes
42
+ shell : bash
43
+ run : |
44
+ CHANGELOG="$(./gradlew getChangelog -q)"
45
+
46
+ echo 'version_release_notes<<EOF' >> $GITHUB_OUTPUT
47
+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
48
+ echo 'EOF' >> $GITHUB_OUTPUT
49
+
50
+ echo "Release notes to be added:"
51
+ echo "$CHANGELOG"
52
+
53
+ - name : Create new tag and release
54
+ env :
55
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56
+ run : |
57
+ git tag ${{ steps.properties.outputs.versionSemVer }}
58
+ git push origin ${{ steps.properties.outputs.versionSemVer }}
59
+ gh release create ${{ steps.properties.outputs.versionSemVer }} --title ${{ steps.properties.outputs.versionSemVer }} --target ${{ steps.properties.outputs.currCommit }} -F- <<EOF
60
+ ${{ steps.release_notes.outputs.version_release_notes }}
61
+ EOF
62
+
63
+ - name : Upload Release Built Artifact
64
+ continue-on-error : true
65
+ env :
66
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67
+ run : gh release upload ${{ steps.properties.outputs.versionSemVer }} ./build/distributions/*
68
+
69
+ - uses : ./.github/actions/teardown
70
+
71
+ - name : Bump version in gradle.properties
72
+ run : |
73
+ # Read current version in gradle.properties
74
+ current_version=$(grep -E "^version=" gradle.properties | cut -d'=' -f2)
75
+ echo "Current version: $current_version"
76
+
77
+ # Splitting the prefix and the last number
78
+ prefix=$(echo "$current_version" | sed 's/[0-9]*$//') # Leave prefix without the last number
79
+ last_number=$(echo "$current_version" | grep -oE '[0-9]+$') # Fetching the number
80
+ new_number=$((last_number + 1))
81
+ new_version="${prefix}${new_number}"
82
+
83
+ echo "New version: $new_version"
84
+
85
+ # Update version in gradle.properties
86
+ sed -i "s/^version=.*/version=${new_version}/" gradle.properties
87
+
88
+ echo "gradle.properties after change:"
89
+ cat gradle.properties
90
+
91
+ - name : Close Milestone
92
+ continue-on-error : true
93
+ env :
94
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
95
+ run : |
96
+ gh api repos/{owner}/{repo}/milestones \
97
+ --jq '.[] | select(.title == "${{ steps.properties.outputs.versionSemVer }}") | .number' \
98
+ | xargs -I '{}' gh api -X PATCH repos/{owner}/{repo}/milestones/{} -F state='closed'
99
+
12
100
release :
13
101
runs-on : ubuntu-latest
14
102
timeout-minutes : 40
15
103
16
104
steps :
17
- - uses : actions/checkout@v3
105
+ - uses : actions/checkout@v4
18
106
with :
19
107
ref : ${{ github.head_ref }}
20
108
token : ${{ secrets.ZOWE_ROBOT_TOKEN }}
@@ -33,13 +121,11 @@ jobs:
33
121
- name : Set name
34
122
run : git config user.name "For Mainframe"
35
123
36
- - name : Release with Gradle automatic
37
- run : ./gradlew release -x test -x updateVersion -x commitNewVersion -Prelease.useAutomaticVersion=true -Prelease.scope=${{ github.event.inputs.scope || env.DEFAULT_SCOPE }} -Pzowe.deploy.username=$ARTIFACTORY_USERNAME -Pzowe.deploy.password=$ARTIFACTORY_PASSWORD -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_USERNAME
38
- env :
39
- ARTIFACTORY_USERNAME : ${{ secrets.ARTIFACTORY_USERNAME }}
40
- ARTIFACTORY_PASSWORD : ${{ secrets.ARTIFACTORY_PASSWORD }}
41
- DEFAULT_SCOPE : ' patch'
42
- BUILD_NUMBER : ${{ github.run_number }}
43
- BRANCH_NAME : ${{ github.ref_name }}
44
-
45
- - uses : ./.github/actions/teardown
124
+ # - name: Release with Gradle automatic
125
+ # run: ./gradlew release -x test -x updateVersion -x commitNewVersion -Prelease.useAutomaticVersion=true -Prelease.scope=${{ github.event.inputs.scope || env.DEFAULT_SCOPE }} -Pzowe.deploy.username=$ARTIFACTORY_USERNAME -Pzowe.deploy.password=$ARTIFACTORY_PASSWORD -Partifactory_user=$ARTIFACTORY_USERNAME -Partifactory_password=$ARTIFACTORY_USERNAME
126
+ # env:
127
+ # ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
128
+ # ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
129
+ # DEFAULT_SCOPE: 'patch'
130
+ # BUILD_NUMBER: ${{ github.run_number }}
131
+ # BRANCH_NAME: ${{ github.ref_name }}
0 commit comments