-
Notifications
You must be signed in to change notification settings - Fork 31
72 lines (62 loc) · 2.1 KB
/
deploy.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
69
70
71
72
name: Deploy
on:
workflow_dispatch:
inputs:
version_type:
description: "The type of the release version."
required: true
type: choice
options:
- major
- minor
- patch
- alpha
increment:
description: "Whether to increment the version before release."
type: boolean
default: true
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Update Version
id: update-version
run: |
output=$(python scripts/deploy/update_version.py ${{ inputs.version_type }} ${{ inputs.increment }})
echo "VERSION=$output" >> $GITHUB_OUTPUT
- name: Generate Changelogs
run: |
pip install ".[dev.changelog]"
towncrier build --yes --version ${{ steps.update-version.outputs.VERSION }}
python scripts/deploy/populate_changelog.py CHANGES.md docs/source/changelogs/v3-changelog.md
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Bump version, update changelog"
file_pattern: "lightbulb/*.py docs/source/changelogs/*.md"
- name: Upload to PyPI
env:
FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }}
FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }}
run: |
pip install ".[dev.release]"
flit publish
- name: Create Tag
run: |
git tag ${{ steps.update-version.outputs.VERSION }}
git push origin ${{ steps.update-version.outputs.VERSION }}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
token: "${{ secrets.GITHUB_TOKEN }}"
name: "v${{ steps.update-version.outputs.VERSION }}"
tag_name: "refs/tags/${{ steps.update-version.outputs.VERSION }}"
body_path: CHANGES.md
prerelease: ${{ inputs.version_type == 'alpha' }}