forked from AxonFramework/AxonFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (85 loc) · 3.37 KB
/
release-notes.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
name: Milestone Closure
on:
milestone:
types: [closed]
env:
CA_FILE: /tmp/ca.pem
URL: https://discuss.axoniq.io/posts.json
CATEGORY: 6 # id of `Announcements` category in Discuss
jobs:
create-release-notes:
runs-on: ubuntu-latest
outputs:
notes: ${{ steps.extract-version-and-notes.outputs.RELEASE_NOTES_FILE }}
version: ${{ steps.extract-version-and-notes.outputs.VERSION }}
date: ${{ steps.extract-version-and-notes.outputs.RELEASE_DATE }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release Notes Markdown
uses: docker://decathlon/release-notes-generator-action:3.1.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
OUTPUT_FOLDER: temp_release_notes
USE_MILESTONE_TITLE: "true"
- name: Set Release environment- and output-variables
id: extract-version-and-notes
run: |
RELEASE_NOTES_FILE=$(ls temp_release_notes/*.md | head -n 1)
echo "RELEASE_NOTES_FILE=$RELEASE_NOTES_FILE" >> $GITHUB_ENV
echo "RELEASE_NOTES_FILE=$RELEASE_NOTES_FILE" >> $GITHUB_OUTPUT
VERSION=$(echo ${{ github.event.milestone.title }} | cut -d' ' -f2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "RELEASE_DATE=$(date +'%b %d, %Y')" >> $GITHUB_OUTPUT
- name: Add Release Notes to cache
id: cache-notes
uses: actions/cache@v4
with:
path: ${{ env.RELEASE_NOTES_FILE }}
key: notes
- name: Create a Draft Release Notes on GitHub
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: axon-${{ env.VERSION }}
release_name: Axon Framework v${{ env.VERSION }}
body_path: ${{ env.RELEASE_NOTES_FILE }}
draft: true
announce-on-discuss:
runs-on: ubuntu-latest
needs: create-release-notes
steps:
- name: Get authorities certificates
run: openssl s_client -showcerts -connect discuss.axoniq.io:443 </dev/null | sed -n -e '/-.BEGIN/,/-.END/ p' > $CA_FILE
- name: Retrieve Release Notes from cache
id: cache-notes
uses: actions/cache@v4
with:
path: ${{ needs.create-release-notes.outputs.notes }}
key: notes
- name: Read release notes file
id: read_release_notes
uses: juliangruber/read-file-action@v1
with:
path: ${{ needs.create-release-notes.outputs.notes }}
- name: Create Discuss topic
run: |
echo $json | curl --cacert $CA_FILE -X POST "$URL" \
-H "Api-Key: ${{ secrets.DISCUSS_KEY }}" \
-H "Api-Username: axonbot" \
-H 'Content-Type: application/json' \
--data-binary @- << EOF
{
"title": "Axon Framework - Release ${{ needs.create-release-notes.outputs.version }}",
"raw": "
I’m glad to announce that we’ve released Axon Framework version ${{ needs.create-release-notes.outputs.version }} on ${{ needs.create-release-notes.outputs.date }}.
This release contains:
${{ steps.read_release_notes.outputs.content }}
",
"category": $CATEGORY,
"tags": ["release"]
}
EOF