-
Notifications
You must be signed in to change notification settings - Fork 60
56 lines (51 loc) · 1.85 KB
/
release.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
name: changelog and release automation
on:
push:
branches:
- master
jobs:
changelog:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[RELEASE]')"
steps:
- uses: actions/checkout@master
- name: calculate next version
id: version
uses: patrickjahns/version-drafter-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: update changelog
uses: patrickjahns/chlgr@v1
with:
release-version: ${{ steps.version.outputs.next-version }}
release:
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[RELEASE]')"
steps:
- uses: actions/checkout@master
- name: extract version from commit message
shell: bash
run: |
VERSION=$(echo "${COMMIT_MSG}" | grep -Po '\d+.\d+.\d+')
CHANGELOG=$(cat CHANGELOG.md | sed -n '/^## \[/{p; :loop n; /^## \[/q; p; b loop}')
CHANGELOG="${CHANGELOG%??}"
CHANGELOG="${CHANGELOG//'%'/'%25'}"
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "changelog=${CHANGELOG}" >> $GITHUB_OUTPUT
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
id: version
- name: create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.version.outputs.version }}
RELASE_NOTES: ${{ steps.version.outputs.changelog }}
run: |
RELASE_NOTES="${RELASE_NOTES//$'%0A'/'\n'}"
echo -e $RELASE_NOTES | gh release create "${RELEASE_TAG}" --title "${RELEASE_TAG}" --notes-file -
- name: galaxy
uses: robertdebock/galaxy-action@1.2.1
with:
galaxy_api_key: ${{ secrets.galaxy_api_key }}