Skip to content

Commit afa4774

Browse files
committed
feat: 改用 GitHub release 触发构建
Signed-off-by: Ke Jie <[email protected]>
1 parent 591740d commit afa4774

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,18 @@
1-
name: Build and Publish Package (for open-dingtalk)
1+
name: Build and Publish Package
22
on:
3-
push:
4-
branches:
5-
- main
3+
release:
4+
types: [published]
65
jobs:
76
build-and-publish:
87
runs-on: ubuntu-latest
98
steps:
109
- name: Checkout
1110
uses: actions/checkout@v2
12-
- name: Check Commit Message
13-
id: check_commit_message
14-
run: |
15-
VERSION=$(python setup.py --version)
16-
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
17-
if [[ $(git log -1 --pretty='format:%B' ${{ github.sha }}) == *"release"* ]] && [[ "${{ github.repository_owner }}" == "open-dingtalk" ]]; then
18-
echo "build_package=true" >> $GITHUB_OUTPUT
19-
else
20-
echo "build_package=false" >> $GITHUB_OUTPUT
21-
fi
22-
- name: Debug Github Output
23-
run: |
24-
echo ${{ steps.check_commit_message.outputs.build_package }}
2511
- name: Build Package
26-
if: ${{ steps.check_commit_message.outputs.build_package }} == 'true'
2712
run: |
2813
python setup.py sdist bdist_wheel
2914
- name: Publish Package
30-
if: ${{ steps.check_commit_message.outputs.build_package }} == 'true'
3115
uses: pypa/gh-action-pypi-publish@master
3216
with:
3317
user: __token__
3418
password: ${{ secrets.PYPI_API_TOKEN }}
35-
- name: Tag this Commit
36-
id: tag_version
37-
if: github.ref == 'refs/heads/master' && ${{ steps.check_commit_message.outputs.build_package }} == 'true'
38-
uses: mathieudutour/[email protected]
39-
with:
40-
custom_tag: ${{ steps.check_commit_message.outputs.version }}
41-
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)