@@ -6,9 +6,16 @@ name: upload
66# Controls when the action will run.
77on :
88 # Allows you to run this workflow manually from the Actions tab
9- push :
10- branches :
11- - master
9+ workflow_dispatch :
10+ inputs :
11+ upload_server :
12+ description : ' upload server'
13+ required : true
14+ default : ' testpypi'
15+ type : choice
16+ options :
17+ - ' testpypi'
18+ - ' pypi'
1219
1320# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1421jobs :
@@ -19,17 +26,32 @@ jobs:
1926 steps :
2027 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2128 - uses : actions/checkout@v4
29+
2230 # Sets up python3
2331 - uses : actions/setup-python@v5
2432 with :
2533 python-version : ' 3.10'
34+
2635 # Installs and upgrades pip, installs other dependencies and installs the package from setup.py
2736 - name : Install dependencies
2837 run : |
2938 # Upgrade pip
3039 python3 -m pip install --upgrade pip
3140 # Install twine
3241 python3 -m pip install build setuptools wheel twine
42+
43+ # Upload to TestPyPI
44+ - name : Build and Upload to TestPyPI
45+ if : ${{ inputs.upload_server == 'testpypi' }}
46+ run : |
47+ python3 -m build
48+ python3 -m twine check dist/* --strict
49+ python3 -m twine upload dist/*
50+ env :
51+ TWINE_USERNAME : __token__
52+ TWINE_PASSWORD : ${{ secrets.TESTPYPI }}
53+ TWINE_REPOSITORY : testpypi
54+
3355 # Upload to PyPI
3456 - name : Build and Upload to PyPI
3557 run : |
@@ -40,10 +62,15 @@ jobs:
4062 TWINE_USERNAME : __token__
4163 TWINE_PASSWORD : ${{ secrets.PYPI }}
4264 TWINE_REPOSITORY : pypi
65+
66+ # Wait some time
4367 - name : Sleep for 300s to make release available
68+ if : ${{ inputs.upload_server == 'pypi' }}
4469 uses : juliangruber/sleep-action@v2
4570 with :
4671 time : 300s
72+
73+ # Run an installation for testing
4774 - name : Install simbench from PyPI
4875 run : |
4976 python3 -m pip install simbench
0 commit comments