-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (62 loc) · 1.95 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
57
58
59
60
61
62
63
64
65
66
67
68
name: Release New Version
on:
workflow_dispatch:
inputs:
releaseType:
description: The type of the release patch/minor/major
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0
- name: Set up Python 3.7
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.7
- run: pip install --upgrade pip
- run: pip install build bumpver
- name: git setup
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: bumpver update --${{inputs.releaseType}}
- run: python -m build
- uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
with:
name: package
path: dist/
publish:
name: Publish
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: package
path: dist/
- name: Publish to Test PyPI
if: ${{github.ref_name == 'test_pypi'}}
uses: pypa/gh-action-pypi-publish@61da13deb5f5124fb1536194f82ed3d9bbc7e8f3 # release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: ${{github.ref_name != 'test_pypi'}}
uses: pypa/gh-action-pypi-publish@61da13deb5f5124fb1536194f82ed3d9bbc7e8f3 # release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}