Skip to content

Commit 4c80a2b

Browse files
committed
Update release workflow
1 parent bcc516f commit 4c80a2b

File tree

2 files changed

+84
-2
lines changed

2 files changed

+84
-2
lines changed

.github/rlnotes.mustache

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{#headerslength}}
2+
# Generic Notes
3+
4+
{{/headerslength}}
5+
{{#headers}}
6+
**{{title}}**
7+
{{body}}
8+
9+
{{/headers}}
10+
# Issues
11+
12+
{{#issues}}
13+
{{repo}}#{{number}} {{title}}
14+
{{/issues}}
15+
16+
{{#footerslength}}
17+
# Additional Notes
18+
19+
{{/footerslength}}
20+
{{#footers}}
21+
**{{title}}**
22+
{{body}}
23+
24+
{{/footers}}

.github/workflows/release-ga.yml

+60-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
# jobs can work on it.
1616
staging:
1717
runs-on: ubuntu-latest
18+
outputs:
19+
project-version: ${{ steps.output.outputs.project-version }}
1820
steps:
1921
- uses: actions/checkout@v2
2022
- uses: actions/setup-java@v1
@@ -57,6 +59,12 @@ jobs:
5759
tag-release-branch: ${{ env.PROJECT_VERSION }}
5860
tag-release-tag: ${{ env.PROJECT_VERSION }}
5961
tag-release-tag-prefix: v
62+
- name: Output
63+
id: output
64+
env:
65+
PROJECT_VERSION: ${{ env.PROJECT_VERSION }}
66+
run: |
67+
echo "::set-output name=project-version::$PROJECT_VERSION"
6068
6169
# wait manual approval.
6270
# promote build from staging to releases
@@ -82,7 +90,7 @@ jobs:
8290
--server-id-deploy=repo.spring.io \
8391
--repo-resolve=libs-release \
8492
--repo-deploy=libs-staging-local
85-
echo JFROG_CLI_BUILD_NAME=spring-statemachine-24x-release >> $GITHUB_ENV
93+
echo JFROG_CLI_BUILD_NAME=spring-statemachine-22x-release >> $GITHUB_ENV
8694
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
8795
# promoting build from staging repo into release
8896
- name: Promote Build
@@ -97,13 +105,63 @@ jobs:
97105
commit-changes-branch: 2.4.x
98106
commit-changes-message: Next development version
99107

108+
# gh release before central
109+
ghrelease:
110+
runs-on: ubuntu-latest
111+
needs: [staging, promote]
112+
steps:
113+
- uses: actions/checkout@v2
114+
- name: Install Tooling
115+
run: |
116+
curl -sSL https://github.com/cbroglie/mustache/releases/download/v1.2.2/mustache_1.2.2_linux_amd64.tar.gz | sudo tar -C /usr/local/bin/ --no-same-owner -xzv mustache
117+
- name: GitHub Release
118+
env:
119+
PROJECT_VERSION: ${{needs.staging.outputs.project-version}}
120+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
121+
RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5
122+
RELEASE_NOTES_DATA: ${{runner.temp}}/release_notes_data.json
123+
RELEASE_NOTES_HEADERS: ${{runner.temp}}/release_notes_headers.json
124+
RELEASE_NOTES_FOOTERS: ${{runner.temp}}/release_notes_footers.json
125+
RELEASE_NOTES_ISSUES: ${{runner.temp}}/release_notes_issues.json
126+
run: |
127+
gh issue list \
128+
--repo spring-projects/spring-statemachine \
129+
--milestone $PROJECT_VERSION \
130+
--label automation/rlnotes-header \
131+
--state all --json title,body \
132+
--jq '{headers:map(.),headerslength:(length)}' \
133+
> $RELEASE_NOTES_HEADERS
134+
gh issue list \
135+
--repo spring-projects/spring-statemachine \
136+
--milestone $PROJECT_VERSION \
137+
--label automation/rlnotes-footer \
138+
--state all --json title,body \
139+
--jq '{footers:map(.),footerslength:(length)}' \
140+
> $RELEASE_NOTES_FOOTERS
141+
gh issue list \
142+
--repo spring-projects/spring-statemachine \
143+
--milestone $PROJECT_VERSION \
144+
--state all --json number,title,labels \
145+
--jq '{issues:map(select((.labels | length == 0) or (any(.labels[].name; startswith("automation/rlnotes")|not))))}' \
146+
> $RELEASE_NOTES_ISSUES
147+
jq -s '{issues:(.[0].issues),headers:(.[1].headers),headerslength:(.[1].headerslength),footers:(.[2].footers), footerslength:(.[2].footerslength)}' \
148+
$RELEASE_NOTES_ISSUES \
149+
$RELEASE_NOTES_HEADERS \
150+
$RELEASE_NOTES_FOOTERS \
151+
> $RELEASE_NOTES_DATA
152+
mustache $RELEASE_NOTES_DATA .github/rlnotes.mustache > $RELEASE_NOTES_FILE
153+
gh release create v$PROJECT_VERSION \
154+
--draft \
155+
--title "$PROJECT_VERSION" \
156+
--notes-file $RELEASE_NOTES_FILE
157+
100158
# wait manual approval.
101159
# pull released artifacts from repo and do a dance with central sync where we
102160
# create checksum and signature files, create staging repo and upload
103161
# files into it, and then finally close and release that repo.
104162
central:
105163
runs-on: ubuntu-latest
106-
needs: promote
164+
needs: ghrelease
107165
environment: central
108166
steps:
109167
# need repo for spec file

0 commit comments

Comments
 (0)