-
Notifications
You must be signed in to change notification settings - Fork 27
72 lines (62 loc) · 1.86 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
69
70
71
72
name: Python package
on:
push:
branches:
- main
jobs:
Test:
runs-on: windows-latest
permissions: write-all
env:
POETRY_HTTP_TIMEOUT: 600
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history for semantic-release
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10' # You can specify your required Python version here
- name: Install Poetry and Build
run: |
pip install poetry
shell: bash
- name: Check release status
id: release-status
run: |
pip install python-semantic-release
if semantic-release --noop --strict version; then
echo "::set-output name=released::true"
else
echo "::set-output name=released::false"
fi
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Semantic Release Version
if: steps.release-status.outputs.released == 'true'
run: |
semantic-release version
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: Release to PyPI
if: steps.release-status.outputs.released == 'true'
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
shell: bash
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: Release to GitHub
if: steps.release-status.outputs.released == 'true'
run: |
git fetch --tags
for file in ./dist/*; do
gh release upload "${{ steps.release-status.outputs.tag }}" $file
done
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}