-
Notifications
You must be signed in to change notification settings - Fork 8
73 lines (70 loc) · 1.98 KB
/
release.yml
File metadata and controls
73 lines (70 loc) · 1.98 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
name: Release
on:
push:
branches: [main]
workflow_dispatch:
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
output=$(npx -p semantic-release \
-p @semantic-release/changelog \
-p @semantic-release/git \
-p @semantic-release/github \
-p conventional-changelog-conventionalcommits \
semantic-release 2>&1) && exit_code=0 || exit_code=$?
echo "$output"
if echo "$output" | grep -q "Published release"; then
echo "new_release_published=true" >> "$GITHUB_OUTPUT"
else
echo "new_release_published=false" >> "$GITHUB_OUTPUT"
fi
exit $exit_code
publish:
name: Publish to PyPI
needs: release
if: needs.release.outputs.new_release_published == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true