Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaad344b

Browse files
committed
add workflow to publish to PyPI
This workflow is triggered when publishing a new releaseusing the GitHub Releases functionality. It can also betriggered manually for testing.The workflow will always publish to Test PyPI, but willonly publish to the real PyPI, when releasing a newversion using the GitHub Releases functionality.The version for the package is generated by setuptools_scm,based on the git tags/commits. For all non-tagged commits,a "dev version" is generated with the format "0.1.2-dev3",where 0.1.2 is the latest tag plus one more in the last partof the version number (i.e. given the last tag was 0.1.1,0.1.2 will be used for the dev version) and the 3 in "-dev3"comes from the number of commits since the last tag.(This all is standard setuptools_scm behaviour.)
1 parent6625e55 commitaad344b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

‎.github/workflows/publish.yml‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name:Publish Python Package
2+
3+
on:
4+
# trigger when publishing a release
5+
release:
6+
types:[published]
7+
8+
# also allow triggering this workflow manually for testing
9+
workflow_dispatch:
10+
11+
jobs:
12+
publish:
13+
14+
runs-on:ubuntu-latest
15+
16+
steps:
17+
-name:Checkout
18+
uses:actions/checkout@v2
19+
with:
20+
# just fetching 1 commit is not enough for setuptools-scm, so we fetch all
21+
fetch-depth:0
22+
-name:Set up Python
23+
uses:actions/setup-python@v2
24+
with:
25+
python-version:'3.x'
26+
-name:Install dependencies
27+
run:|
28+
pip install setuptools setuptools_scm
29+
-name:Build package
30+
run:|
31+
python setup.py sdist
32+
rm dist/*.orig # clean sdist_upip noise
33+
-name:Publish to Test PyPI
34+
uses:pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
password:${{ secrets.TEST_PYPI_API_TOKEN }}
37+
repository_url:https://test.pypi.org/legacy/
38+
-name:Publish to PyPI
39+
uses:pypa/gh-action-pypi-publish@release/v1
40+
if:github.event.release.tag_name# only when releasing a new version
41+
with:
42+
password:${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp