-
Notifications
You must be signed in to change notification settings - Fork 101
96 lines (89 loc) · 3.63 KB
/
sync-readme-changelog.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
name: Update Version History on Readme
on:
release:
types: [published]
jobs:
update-changelog:
runs-on: ubuntu-latest
steps:
- name: Format and publish release notes to version history doc
id: update
run: |
# Get release name, body, and date from the release event
release_name="${{ github.event.release.tag_name }}"
release_body="${{ github.event.release.body }}"
release_date=$(date -d "${{ github.event.release.published_at }}" +"%Y-%m-%d")
# Format release notes
formatted_notes="## [$release_name] - $release_date\n\n$release_body"
# Get existing version history page
existing_content=$(curl --request GET \
--url https://dash.readme.com/api/v1/docs/web-version-history \
--header 'accept: application/json' \
--header "authorization: Basic ${{ secrets.readme_api_key_base64 }}" \
| jq -r '.body')
# Prepend new release notes to existing content
new_content=$(echo -e "$formatted_notes\n\n$existing_content")
payload=$(jq -n --arg nc "$new_content" '{"body": $nc}')
# Update version history page with new release notes
curl --request PUT \
--url https://dash.readme.com/api/v1/docs/web-version-history \
--header 'accept: application/json' \
--header "authorization: Basic ${{ secrets.readme_api_key_base64 }}" \
--header 'content-type: application/json' \
--data "$payload"
- name: Announce New Release in Slack
uses: slackapi/[email protected]
with:
channel-id: "C063MQJMKJN" #sdk-releases
payload: |
{
"text": "New Release: Branch Web SDK ${{ github.event.release.tag_name }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":rocket: New Release: Branch Web SDK ${{ github.event.release.tag_name }}",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":star: *What's New*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(github.event.release.body) }}
}
},
{
"type": "divider"
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":git: GitHub Release",
"emoji": true
},
"value": "github",
"action_id": "github",
"url": "${{ github.event.release.html_url }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_SDK_BOT_TOKEN }}