Skip to content

Commit b26d877

Browse files
committed
Add github release to milestone release
1 parent 6a2e51d commit b26d877

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/rlnotes.mustache

Lines changed: 24 additions & 0 deletions
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-milestone.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
# jobs can work on it.
2020
staging:
2121
runs-on: ubuntu-latest
22+
outputs:
23+
project-version: ${{ steps.output.outputs.project-version }}
2224
steps:
2325
- uses: actions/checkout@v2
2426
- uses: actions/setup-java@v1
@@ -61,6 +63,12 @@ jobs:
6163
tag-release-branch: ${{ env.PROJECT_VERSION }}
6264
tag-release-tag: ${{ env.PROJECT_VERSION }}
6365
tag-release-tag-prefix: v
66+
- name: Output
67+
id: output
68+
env:
69+
PROJECT_VERSION: ${{ env.PROJECT_VERSION }}
70+
run: |
71+
echo "::set-output name=project-version::$PROJECT_VERSION"
6472
6573
# wait manual approval.
6674
# promote build from staging to milestones
@@ -92,3 +100,53 @@ jobs:
92100
- name: Promote Build
93101
run: |
94102
jfrog rt build-promote libs-milestone-local
103+
104+
ghrelease:
105+
runs-on: ubuntu-latest
106+
needs: [staging, promote]
107+
steps:
108+
- uses: actions/checkout@v2
109+
- name: Install Tooling
110+
run: |
111+
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
112+
- name: GitHub Release
113+
env:
114+
PROJECT_VERSION: ${{needs.staging.outputs.project-version}}
115+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
116+
RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5
117+
RELEASE_NOTES_DATA: ${{runner.temp}}/release_notes_data.json
118+
RELEASE_NOTES_HEADERS: ${{runner.temp}}/release_notes_headers.json
119+
RELEASE_NOTES_FOOTERS: ${{runner.temp}}/release_notes_footers.json
120+
RELEASE_NOTES_ISSUES: ${{runner.temp}}/release_notes_issues.json
121+
run: |
122+
gh issue list \
123+
--repo spring-projects/spring-statemachine \
124+
--milestone $PROJECT_VERSION \
125+
--label automation/rlnotes-header \
126+
--state all --json title,body \
127+
--jq '{headers:map(.),headerslength:(length)}' \
128+
> $RELEASE_NOTES_HEADERS
129+
gh issue list \
130+
--repo spring-projects/spring-statemachine \
131+
--milestone $PROJECT_VERSION \
132+
--label automation/rlnotes-footer \
133+
--state all --json title,body \
134+
--jq '{footers:map(.),footerslength:(length)}' \
135+
> $RELEASE_NOTES_FOOTERS
136+
gh issue list \
137+
--repo spring-projects/spring-statemachine \
138+
--milestone $PROJECT_VERSION \
139+
--state all --json number,title,labels \
140+
--jq '{issues:map(select((.labels | length == 0) or (any(.labels[].name; startswith("automation/rlnotes")|not))))}' \
141+
> $RELEASE_NOTES_ISSUES
142+
jq -s '{issues:(.[0].issues),headers:(.[1].headers),headerslength:(.[1].headerslength),footers:(.[2].footers), footerslength:(.[2].footerslength)}' \
143+
$RELEASE_NOTES_ISSUES \
144+
$RELEASE_NOTES_HEADERS \
145+
$RELEASE_NOTES_FOOTERS \
146+
> $RELEASE_NOTES_DATA
147+
mustache $RELEASE_NOTES_DATA .github/rlnotes.mustache > $RELEASE_NOTES_FILE
148+
gh release create v$PROJECT_VERSION \
149+
--draft \
150+
--prerelease \
151+
--title "$PROJECT_VERSION" \
152+
--notes-file $RELEASE_NOTES_FILE

0 commit comments

Comments
 (0)