-
Notifications
You must be signed in to change notification settings - Fork 4
172 lines (142 loc) · 5.88 KB
/
release.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time.
# After the build stage is finished, it is ready to be published to the respective public repositories
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Release
on:
workflow_dispatch:
jobs:
changelog-and-preparations:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout the plugin GitHub repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- name: Fetch Gradle properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
PLUGIN_VERSION_FULL="$(echo "$PROPERTIES" | grep "^pluginVersion:" | cut -f2- -d ' ')"
CURR_COMMIT="$(git rev-parse HEAD)"
echo "pluginVersionSemVer: $PLUGIN_VERSION_FULL"
echo "currCommit: $CURR_COMMIT"
echo "pluginVersionSemVer=$PLUGIN_VERSION_FULL" >> $GITHUB_OUTPUT
echo "currCommit=$CURR_COMMIT" >> $GITHUB_OUTPUT
- 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 tag and release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag ${{ steps.properties.outputs.pluginVersionSemVer }}
git push origin ${{ steps.properties.outputs.pluginVersionSemVer }}
gh release create ${{ steps.properties.outputs.pluginVersionSemVer }} --title ${{ steps.properties.outputs.pluginVersionSemVer }} --target ${{ steps.properties.outputs.currCommit }} -F- <<EOF
${{ steps.release_notes.outputs.version_release_notes }}
EOF
# - name: Create Pull Request
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# VERSION="${{ steps.properties.outputs.pluginVersionSemVer }}"
# BRANCH="release-changelog-update-$VERSION"
# git config user.email "[email protected]"
# git config user.name "GitHub Action"
# git checkout -b $BRANCH
# git commit -am ":moyai: ${VERSION}" -m "[skip ci]"
# git push --set-upstream origin $BRANCH
# gh pr create \
# --title ":moyai: \`$VERSION\`" \
# --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
# --base "release/v$VERSION" \
# --head $BRANCH
- 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.pluginVersionSemVer }}") | .number' \
| xargs -I '{}' gh api -X PATCH repos/{owner}/{repo}/milestones/{} -F state='closed'
release:
needs: [changelog-and-preparations]
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
product: ["IC-231","IC-233","IC-243"]
include:
- product: "IC-231"
distribution: "zulu"
java: "17"
- product: "IC-233"
distribution: "zulu"
java: "17"
- product: "IC-243"
distribution: "zulu"
java: "21"
max-parallel: 10
fail-fast: false
steps:
- name: Checkout the plugin GitHub repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- name: Fetch Gradle properties for a specific product
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
PLUGIN_VERSION="$(echo "$PROPERTIES" | grep "^pluginVersion:" | cut -f2- -d ' ')"
echo "pluginVersion: $PLUGIN_VERSION"
echo "pluginVersion=$PLUGIN_VERSION" >> $GITHUB_OUTPUT
- name: Publish Plugin
env:
ZOWE_INTELLIJ_MARKET_TOKEN: ${{ secrets.ZOWE_INTELLIJ_MARKET_TOKEN }}
INTELLIJ_SIGNING_CERTIFICATE_CHAIN: ${{ secrets.INTELLIJ_SIGNING_CERTIFICATE_CHAIN }}
INTELLIJ_SIGNING_PRIVATE_KEY: ${{ secrets.INTELLIJ_SIGNING_PRIVATE_KEY }}
INTELLIJ_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.INTELLIJ_SIGNING_PRIVATE_KEY_PASSWORD }}
PRODUCT_NAME: ${{ matrix.product }}
run: ./gradlew signPlugin
- name: Upload Release Built Artifact
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.properties.outputs.pluginVersion }} ./build/distributions/*