-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (53 loc) · 1.85 KB
/
create-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
57
58
59
60
61
62
63
64
65
66
67
name: Create Release
on:
create
jobs:
create-release:
if: startsWith(github.ref_name, 'version-') && endsWith(github.ref_name, '-create-release')
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup
id: setup
run: |
# install python dependencies
pip install typer==0.4.0 click==8.0.3
# variables
RELEASE_VERSION='${{ github.ref_name }}'
RELEASE_VERSION=${RELEASE_VERSION//version-/}
RELEASE_VERSION=${RELEASE_VERSION//-create-release/}
echo "::set-output name=RELEASE_VERSION::${RELEASE_VERSION}"
- name: Test Environment
run: |
RELEASE_VERSION='${{ steps.setup.outputs.RELEASE_VERSION }}'
# setup git
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# switch to master
git pull origin master
git checkout master
# update version
python scripts/update_version.py $RELEASE_VERSION
git commit -am "Update version to $RELEASE_VERSION"
# create tag
git fetch --tags
git tag $RELEASE_VERSION
# push to master
git push
git push --tags
# delete branch
git push -d origin ${{ github.ref_name }}
- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.setup.outputs.RELEASE_VERSION }}
release_name: ${{ steps.setup.outputs.RELEASE_VERSION }}
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}