-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (42 loc) · 1.33 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
name: Release Action
on:
workflow_dispatch:
jobs:
Release:
permissions: write-all
runs-on: ubuntu-latest
concurrency: release
steps:
- uses: actions/setup-python@v3
with:
python-version: 3.8
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check release status
id: release-status
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install python-semantic-release
if semantic-release --noop --strict version
then
echo "Releasing new version."
else
echo "Skipping release step."
fi
- if: steps.release-status.outputs.released == 'true'
name: Release to GitHub
id: github-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
semantic-release version --no-vcs-release
git fetch --tags
VERSION="${{ steps.release-status.outputs.tag }}"
MAJOR=${VERSION%%.*}
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git tag -fa ${MAJOR} -m "Update major version tag"
git push origin ${MAJOR} --force