Skip to content

Commit 8cbca50

Browse files
authored
👷 add release ci
1 parent 2583195 commit 8cbca50

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Setup Python environment
15+
uses: ./.github/actions/setup-python
16+
17+
- name: Get Version
18+
id: version
19+
run: |
20+
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
21+
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
22+
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
23+
24+
- name: Check Version
25+
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
26+
run: exit 1
27+
28+
- name: Build and Publish Package
29+
run: |
30+
poetry build
31+
poetry publish -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }}
32+
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)