-
Notifications
You must be signed in to change notification settings - Fork 22
75 lines (63 loc) · 2.45 KB
/
release-autowrap.yaml
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
68
69
70
71
72
73
74
75
name: release autowrap
###########################################################################
# please make sure that autowrap version numbers have been properly updated
###########################################################################
on:
workflow_dispatch: # manual trigger
inputs:
next_version:
description: 'Next version (empty = minor bump)'
default: ''
jobs:
build_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Upgrade pip version
run: |
python -m pip install -U pip
- name: Install wheel
run: |
python -m pip install wheel
- name: Build wheel and source distribution
run: |
python setup.py bdist_wheel sdist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_RELEASE_AUTOWRAP }}
packages_dir: ${{ github.workspace }}/dist
- name: Parse version
run: echo "version=$(python3 -c 'from autowrap.version import __version__ as v; print("%d.%d.%d" % v)')" >> $GITHUB_OUTPUT
id: version
- name: Create github release
uses: softprops/action-gh-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.version.outputs.version }}
tag_name: release/${{ steps.version.outputs.version }}
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Setup things for new cycle
id: setup_new
run: |
NEXT_VER=${{ github.event.inputs.next_version }}
OLD_VER=${{ steps.version.outputs.version }}
[ -z "$NEXT_VER" ] && NEXT_VER=$(echo $OLD_VER | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') || true
echo >> HISTORY.md
cat CHANGELOG.md >> HISTORY.md
echo >> HISTORY.md
rm CHANGELOG.md && echo "autowrap $NEXT_VER" > CHANGELOG.md
sed -i -e "s/^[[:space:]]*__version__.*/__version__ = \(${NEXT_VER//./, }\)/g" autowrap/version.py
- uses: stefanzweifel/git-auto-commit-action@v4.15.2
with:
commit_message: New release cycle
file_pattern: CHANGELOG.md HISTORY.md autowrap/version.py