-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (72 loc) · 2.01 KB
/
Copy pathpublish.yml
File metadata and controls
81 lines (72 loc) · 2.01 KB
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
name: Publish
on:
workflow_dispatch:
inputs:
bump_type:
required: true
description: Bump Type
type: choice
options:
- prerelease
- patch
- minor
- major
default: patch
release:
required: true
description: Release
type: boolean
default: true
publish:
required: true
description: Publish
type: boolean
default: true
jobs:
publish-package:
name: Publish Package
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Prepare Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Setup
run: |
make setup-dev
- name: Bump Version
id: bump_version
env:
BUMP_TYPE: ${{ github.event.inputs.bump_type }}
run: |
echo "Bumping type: ${{ env.BUMP_TYPE }}"
new_version=$(semvergit -t ${{ env.BUMP_TYPE }} -v)
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Create Github Release
if: ${{ github.event.inputs.release == 'true' }}
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.new_version }}
release_name: ${{ steps.bump_version.outputs.new_version }}
body: New Release ${{ steps.bump_version.outputs.new_version }}
- name: Build Package
if: ${{ github.event.inputs.publish == 'true' }}
run: |
make build
- name: Publish To PyPI
if: ${{ github.event.inputs.publish == 'true' }}
env:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_USERNAME: ${{ secrets.PYPI_API_USER }}
run: |
make publish