Skip to content

Commit a162cb9

Browse files
committed
Testing automated GH release
1 parent 754f839 commit a162cb9

File tree

2 files changed

+120
-43
lines changed

2 files changed

+120
-43
lines changed

.github/release-drafter.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name-template: 'Release v${{NEXT_VERSION}}'
2+
tag-template: 'v${{NEXT_VERSION}}'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feature'
7+
- 'enhancement'
8+
- title: '🐛 Bug Fixes'
9+
labels:
10+
- 'fix'
11+
- 'bugfix'
12+
- 'bug'
13+
- title: '🧰 Maintenance'
14+
labels:
15+
- 'chore'
16+
- 'maintenance'
17+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
18+
change-title-escapes: '\<*_&'
19+
version-resolver:
20+
major:
21+
labels:
22+
- 'major'
23+
minor:
24+
labels:
25+
- 'minor'
26+
patch:
27+
labels:
28+
- 'patch'
29+
default: patch
30+
template: |
31+
## Changes
32+
33+
$CHANGES

.github/workflows/publish.yml

Lines changed: 87 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,56 +14,100 @@ jobs:
1414
outputs:
1515
publish_to_pypi: ${{ steps.version_check.outputs.publish_to_pypi }}
1616
publish_to_testpypi: ${{ steps.version_check.outputs.publish_to_testpypi }}
17+
version: ${{ steps.version_check.outputs.version }}
1718
steps:
18-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v4
1920

20-
- name: Set up Python
21-
uses: actions/setup-python@v5
22-
with:
23-
python-version: '3.x'
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.x'
2425

25-
- name: Install dependencies for version check
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install requests
26+
- name: Install dependencies for version check
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install requests
2930
30-
- name: Check version on PyPI or TestPyPI
31-
id: version_check
32-
run: |
33-
python3 check_version.py ${{ github.ref }}
34-
env:
35-
GITHUB_OUTPUT: ${{ github.output }}
31+
- name: Check version on PyPI or TestPyPI
32+
id: version_check
33+
run: |
34+
python3 check_version.py ${{ github.ref }}
35+
36+
env:
37+
GITHUB_OUTPUT: ${{ github.output }}
3638

3739
build-and-publish:
3840
needs: prepare-and-check
3941
if: needs.prepare-and-check.outputs.publish_to_pypi == 'true' || needs.prepare-and-check.outputs.publish_to_testpypi == 'true'
4042
runs-on: ubuntu-latest
4143
steps:
42-
- uses: actions/checkout@v4
43-
- name: Set up Python
44-
uses: actions/setup-python@v5
45-
with:
46-
python-version: '3.x'
47-
48-
- name: Install build dependencies
49-
run: |
50-
python -m pip install --upgrade pip
51-
pip install setuptools wheel twine
52-
53-
- name: Build package
54-
run: |
55-
python setup.py sdist bdist_wheel
56-
57-
- name: Publish to PyPI
58-
if: needs.prepare-and-check.outputs.publish_to_pypi == 'true'
59-
run: twine upload dist/*
60-
env:
61-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
62-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
63-
64-
- name: Publish to TestPyPI
65-
if: needs.prepare-and-check.outputs.publish_to_testpypi == 'true'
66-
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
67-
env:
68-
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
69-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
44+
- uses: actions/checkout@v4
45+
46+
- name: Set up Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: '3.x'
50+
51+
- name: Install build dependencies
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install setuptools wheel twine
55+
56+
- name: Build package
57+
run: |
58+
python setup.py sdist bdist_wheel
59+
60+
- name: Upload distribution packages as artifacts
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: python-package-distributions
64+
path: dist/*
65+
66+
- name: Publish to PyPI
67+
if: needs.prepare-and-check.outputs.publish_to_pypi == 'true'
68+
run: twine upload dist/*
69+
env:
70+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
71+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
72+
73+
- name: Publish to TestPyPI
74+
if: needs.prepare-and-check.outputs.publish_to_testpypi == 'true'
75+
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
76+
env:
77+
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
78+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
79+
80+
create-release:
81+
needs: build-and-publish
82+
if: needs.build-and-publish.outputs.publish_to_pypi == 'true'
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: Download distribution packages for release
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: python-package-distributions
91+
path: dist/
92+
93+
- name: Sign the distributions with Sigstore
94+
uses: sigstore/[email protected]
95+
with:
96+
inputs: ./dist/*.tar.gz ./dist/*.whl
97+
98+
- name: Draft Release
99+
id: draft_release
100+
uses: release-drafter/release-drafter@v6
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
104+
- name: Create GitHub Release
105+
uses: actions/create-release@v1
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
with:
109+
tag_name: v${{ needs.prepare-and-check.outputs.version }}
110+
release_name: Release v${{ needs.prepare-and-check.outputs.version }}
111+
body: ${{ steps.draft_release.outputs.body }}
112+
draft: false
113+
prerelease: false

0 commit comments

Comments
 (0)