Deploy Tools #13
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: Deploy Tools | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'pl_build version' | |
required: true | |
default: '1.0.10' | |
deploy: | |
description: 'Deploy (true will deploy to pypi)' | |
required: true | |
default: 'false' | |
deploytest: | |
description: 'Deploy (true will deploy to test pypi)' | |
required: true | |
default: 'false' | |
jobs: | |
build-package: | |
runs-on: windows-2019 | |
strategy: | |
matrix: | |
python-version: [ 3.9 ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel build | |
- name: Build package | |
shell: cmd | |
run: | | |
cd %GITHUB_WORKSPACE% | |
del README.md | |
echo ${{ github.event.inputs.version }} > version_number.txt | |
move pl_build\deploy_setup.py deploy_setup.py | |
move pl_build\README.md README.md | |
del setup.py | |
move deploy_setup.py setup.py | |
echo [build-system] >> pyproject.toml | |
echo requires = ["setuptools", "wheel"] >> pyproject.toml | |
echo build-backend = "setuptools.build_meta" >> pyproject.toml | |
python -m build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pltools wheel | |
path: | | |
${{ github.workspace }}/version_number.txt | |
${{ github.workspace }}/dist/*.whl | |
${{ github.workspace }}/dist/*.tar.gz | |
retention-days: 1 | |
if-no-files-found: error | |
- name: PyPi Deployment | |
shell: cmd | |
if: ${{contains(github.event.inputs.deploy, 'true') && github.ref == 'refs/heads/master'}} | |
run: | | |
python -m pip install twine | |
python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --skip-existing | |
- name: Test PyPi Deployment | |
shell: cmd | |
if: ${{contains(github.event.inputs.deploytest, 'true') && github.ref == 'refs/heads/master'}} | |
run: | | |
python -m pip install twine | |
python -m twine upload --repository testpypi dist/* -u __token__ -p ${{ secrets.TEST_PYPI_API_TOKEN }} --skip-existing |