-
Notifications
You must be signed in to change notification settings - Fork 1
204 lines (163 loc) · 7.14 KB
/
release-new-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# This workflow will release project with Gradle
name: Release new binary version manually
on:
workflow_dispatch:
jobs:
changelog-and-preparations:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.ZOWE_ROBOT_TOKEN }}
- uses: ./.github/actions/setup
- name: Build with Gradle
run: ./gradlew build
- name: Fetch Gradle properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION_FULL="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
CURR_COMMIT="$(git rev-parse HEAD)"
echo "versionSemVer: $VERSION_FULL"
echo "currCommit: $CURR_COMMIT"
echo "versionSemVer=$VERSION_FULL" >> $GITHUB_OUTPUT
echo "currCommit=$CURR_COMMIT" >> $GITHUB_OUTPUT
- name: Clean git
run: |
git reset --hard HEAD
git pull
- name: Set email and user name
run: |
git config user.email "[email protected]"
git config user.name "For Mainframe"
- name: Build new docs with Dokka and publish to the docs branch
run: |
VERSION="${{ steps.properties.outputs.versionSemVer }}"
# git pull origin docs
# git status
git checkout docs
git merge release/v0.5.0
# Preparing the docs
./gradlew dokkaHtml
# Setting up docs/version path
if [ ! -d "docs" ]; then
mkdir -m 755 "docs"
fi
if [ -d "docs/$VERSION" ]; then
rm -rf "docs/$VERSION"
fi
mkdir -m 755 "docs/$VERSION"
# Moving the built docs
mv build/dokka/html/* "docs/$VERSION"
# Writing Jekyll-related things to the index.html
TEMP_FILE=$(mktemp)
echo "---" >> $TEMP_FILE
echo "id: zowe-client-kotlin-sdk-docs" >> $TEMP_FILE
echo "title: Zowe Client Kotlin SDK docs" >> $TEMP_FILE
echo "permalink: /$VERSION/docs/" >> $TEMP_FILE
echo "---" >> $TEMP_FILE
echo "" >> $TEMP_FILE
cat "docs/$VERSION/index.html" >> $TEMP_FILE
mv $TEMP_FILE "docs/$VERSION/index.html"
# - name: Release with Gradle automatic
# 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
# env:
# ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
# ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
# DEFAULT_SCOPE: 'patch'
# BUILD_NUMBER: ${{ github.run_number }}
# BRANCH_NAME: ${{ github.ref_name }}
# - name: Prepare changelog
# shell: bash
# run: ./gradlew patchChangelog
# - name: Prepare release notes
# id: release_notes
# shell: bash
# run: |
# CHANGELOG="$(./gradlew getChangelog -q)"
# echo 'version_release_notes<<EOF' >> $GITHUB_OUTPUT
# echo "$CHANGELOG" >> $GITHUB_OUTPUT
# echo 'EOF' >> $GITHUB_OUTPUT
# echo "Release notes to be added:"
# echo "$CHANGELOG"
# - name: Create new release and upload build artifacts
# if: ${{ !contains(steps.properties.outputs.versionSemVer, '-rc') }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release create ${{ steps.properties.outputs.versionSemVer }} --title ${{ steps.properties.outputs.versionSemVer }} --target ${{ steps.properties.outputs.currCommit }} -F- <<EOF
# ${{ steps.release_notes.outputs.version_release_notes }}
# EOF
# gh release upload ${{ steps.properties.outputs.versionSemVer }} ./build/libs/*
# - name: Bump version in gradle.properties
# run: |
# # Read current version in gradle.properties
# current_version=$(grep -E "^version=" gradle.properties | cut -d'=' -f2)
# echo "Current version: $current_version"
# # Splitting the prefix and the last number
# prefix=$(echo "$current_version" | sed 's/[0-9]*$//') # Leave prefix without the last number
# last_number=$(echo "$current_version" | grep -oE '[0-9]+$') # Fetching the number
# new_number=$((last_number + 1))
# new_version="${prefix}${new_number}"
# echo "New version: $new_version"
# # Update version in gradle.properties
# sed -i "s/^version=.*/version=${new_version}/" gradle.properties
# echo "gradle.properties after change:"
# cat gradle.properties
# - name: Push changes to the release branch
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# VERSION="${{ steps.properties.outputs.versionSemVer }}"
# git config user.email "[email protected]"
# git config user.name "GitHub Action"
# git add gradle.properties
# # No need to change CHANGELOG in -rc. builds
# if [[ "$VERSION" == *"-rc"* ]]; then
# git restore CHANGELOG.md
# fi
# git commit -am ":moyai: ${VERSION}" -m "[skip ci]"
# git push
# - name: Build new docs with Dokka and publish to the docs branch
# run: |
# VERSION="${{ steps.properties.outputs.versionSemVer }}"
# git pull origin docs
# git status
# # git checkout docs
# git merge release/v0.5.0
# # Preparing the docs
# ./gradlew dokkaHtml
# # Setting up docs/version path
# if [ ! -d "docs" ]; then
# mkdir -m 644 "docs"
# fi
# if [ -d "docs/$VERSION"]; then
# rm -rf "docs/$VERSION"
# fi
# mkdir -m 644 "docs/$VERSION"
# # Moving the built docs
# mv build/dokka/html/* "docs/$VERSION"
# # Writing Jekyll-related things to the index.html
# TEMP_FILE=$(mktemp)
# echo "---" >> $TEMP_FILE
# echo "id: zowe-client-kotlin-sdk-docs" >> $TEMP_FILE
# echo "title: Zowe Client Kotlin SDK docs" >> $TEMP_FILE
# echo "permalink: /$VERSION/docs/" >> $TEMP_FILE
# echo "---" >> $TEMP_FILE
# echo "" >> $TEMP_FILE
# cat "docs/$VERSION/index.html" >> $TEMP_FILE
# mv $TEMP_FILE "docs/$VERSION/index.html"
# - name: Close Milestone
# continue-on-error: true
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh api repos/{owner}/{repo}/milestones \
# --jq '.[] | select(.title == "${{ steps.properties.outputs.versionSemVer }}") | .number' \
# | xargs -I '{}' gh api -X PATCH repos/{owner}/{repo}/milestones/{} -F state='closed'
# - uses: ./.github/actions/teardown