Merge pull request #10 from idrblab/swallow-design-patch-1 #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pypi | |
# 任务触发 | |
on: | |
# 当 提交到当前仓库时立即运行 | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Setup Python" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: "Build source" | |
run: | | |
pip install --upgrade pip && | |
pip install build && | |
python -m build | |
- name: Get version | |
id: version | |
uses: frabert/replace-string-action@v2 | |
with: | |
pattern: 'refs/tags/v(.+)' | |
string: ${{ github.ref }} | |
replace-with: 'v$1' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build_${{ steps.version.outputs.replaced }} | |
path: dist/* | |
retention-days: 1 | |
release: | |
needs: ["build"] | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version | |
id: version | |
uses: frabert/replace-string-action@v2 | |
with: | |
pattern: 'refs/tags/v(.+)' | |
string: ${{ github.ref }} | |
replace-with: 'v$1' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build_${{ steps.version.outputs.replaced }} | |
path: dist/ | |
- name: Release to GitHub | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: dist/* | |
draft: true | |
- name: Relase to PyPi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
repository_url: ${{ vars.PYPI_URL }} | |
packages_dir: dist/ |