-
Notifications
You must be signed in to change notification settings - Fork 29
56 lines (49 loc) · 1.63 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: Create Release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Bump version if needed
continue-on-error: true
env:
REF: ${{ github.ref }}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout -b ${REF:10}-update
git tag -d ${REF:10}
git push -d origin ${REF:10}
sed -i "s/version = \".*\"/version = \"${REF:11}\"/" pyproject.toml
git add pyproject.toml
git commit -m "bump version for release"
git tag -a ${REF:10} -m "${REF:10}"
git push -u origin HEAD:main ${REF:10}
- name: Create release branch and bump version
env:
REF: ${{ github.ref }}
run: |
BRANCH=release/${REF:10}
git checkout -b $BRANCH
git push -u origin $BRANCH
- name: Extract Changelog
id: extract_changelog
env:
REF: ${{ github.ref }}
run: |
sed -n "/^## ${REF:10}/,/^## /{/^## /b;p}" docs/changelog.md | sed -r '1d;$d' > ./RELEASE_CHANGELOG
echo ::set-output name=version_name::`sed -nr "s/^## (${REF:10}.*)$/\1/p" docs/changelog.md`
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.extract_changelog.outputs.version_name }}
body_path: ./RELEASE_CHANGELOG
draft: true