forked from arfc/saltproc
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (55 loc) · 2.06 KB
/
populate-releasenotes.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
# Preamble
name: Populate SaltProc release notes
on:
push:
branches:
- 'master'
paths:
- 'doc/releasenotes/v**.rst'
# enable worflow to be run manually
workflow_dispatch:
jobs:
populate-releasenotes:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: install pandoc
run: |
conda install -c conda-forge pandoc
pip install --upgrade pandoc
- name: Get most recent draft release version
run: |
echo "RELEASE_VERSION=$(gh api repos/${{ github.repository }}/releases --jq '.[0] | .name')" >> $GITHUB_ENV
echo "RELEASE_ID=$(gh api repos/${{ github.repository }}/releases --jq '.[0] | .id')" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Convert .rst to .md
run: |
pandoc -o RELEASENOTES.md -f rst -t gfm doc/releasenotes/${{ env.RELEASE_VERSION }}.rst --columns 1000
sed -i "s/# Release notes for ${{ env.RELEASE_VERSION }}//g" RELEASENOTES.md
- name: Populate the release description with RELEASENOTES.md
run: |
CURRENT_TAG=$(gh api repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }} \
-H "Authorize: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X GET \
--jq '.tag_name')
gh api repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }} \
-H "Authorize: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-X PATCH \
-F tag_name=$CURRENT_TAG \
-F body="$(cat RELEASENOTES.md)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}