Skip to content

Commit acea861

Browse files
authored
feat(workflow): auto publish when release
1 parent 6dbf269 commit acea861

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/python-publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# from https://github.com/RF-Tar-Railt/nonebot-plugin-template/blob/main/.github/workflows/release.yml
2+
name: Release action
3+
4+
on:
5+
push:
6+
tags:
7+
- v*
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup Python environment
19+
uses: ./.github/actions/setup-python
20+
21+
- name: Get Version
22+
id: version
23+
run: |
24+
echo "VERSION=$(pdm show --version)" >> $GITHUB_OUTPUT
25+
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
26+
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
27+
28+
- name: Check Version
29+
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
30+
run: exit 1
31+
32+
- name: Publish Package
33+
run: |
34+
pdm publish
35+
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)