-
Notifications
You must be signed in to change notification settings - Fork 41
103 lines (88 loc) · 3.31 KB
/
release.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Release to pypi
on:
workflow_dispatch:
inputs:
version:
description: 'Version to use. Leave default to use the current version'
required: true
default: '~~version~~'
# env:
# comment TWINE_REPOSITORY_URL to use the real pypi. NOTE: change also the secret used in TWINE_PASSWORD
# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
jobs:
release:
name: Release
if: github.actor == 'CaselIT' || github.actor == 'zzzeek' || github.actor == 'MaicoTimmerman'
runs-on: "ubuntu-latest"
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Set version
# A specific version was set in the action trigger.
# Change the version in setup.cfg to that version
if: ${{ github.event.inputs.version != '~~version~~' }}
run: |
python .github/workflows/scripts/update_version.py --set-version ${{ github.event.inputs.version }}
- name: Commit version change
# If the setup.cfg version was changed commit it.
if: ${{ github.event.inputs.version != '~~version~~' }}
uses: sqlalchemyorg/git-auto-commit-action@sa
with:
commit_message: Version ${{ github.event.inputs.version }}
file_pattern: setup.cfg
- name: Get version
# Get current version
id: get-version
run: |
version=`grep 'version =' setup.cfg | awk '{print $NF}'`
echo $version
echo "::set-output name=version::$version"
- name: Create distribution
# Create wheel and sdist
run: |
python -m pip install --upgrade pip
pip --version
pip install build
pip list
python -m build --sdist --wheel .
- name: Create release
# Create github tag and release and upload the distribution wheels and sdist
uses: sqlalchemyorg/action-gh-release@sa
with:
body: Release ${{ steps.get-version.outputs.version }}
files: dist/*
name: 'v${{ steps.get-version.outputs.version }}'
tag_name: v${{ steps.get-version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Next version
# Update the version to the next version
run: |
python .github/workflows/scripts/update_version.py --update-version
- name: Get version
# Get new current version
id: get-new-version
run: |
version=`grep 'version =' setup.cfg | awk '{print $NF}'`
echo $version
echo "::set-output name=version::$version"
- name: Commit next version update
# Commit new current version
uses: sqlalchemyorg/git-auto-commit-action@sa
with:
commit_message: Start work on ${{ steps.get-new-version.outputs.version }}
file_pattern: setup.cfg
- name: Publish distribution
# Publish to pypi
env:
TWINE_USERNAME: __token__
# replace TWINE_PASSWORD with token for real pypi
# TWINE_PASSWORD: ${{ secrets.test_pypi_token }}
TWINE_PASSWORD: ${{ secrets.pypi_token }}
run: |
pip install -U twine
twine upload --skip-existing dist/*