name: publish fate_client to PyPI on: workflow_dispatch: inputs: source: description: 'source branch' required: true target: description: 'target package version' required: true type: description: 'publish type, test or release' required: false default: 'test' jobs: build: name: (${{github.event.inputs.type}} build) branch ${{github.event.inputs.source}} -> package version ${{github.event.inputs.target}} strategy: fail-fast: true runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: ref: ${{github.event.inputs.source}} - uses: actions/setup-python@v2 with: python-version: 3.8 - name: Prepare poetry uses: abatilo/actions-poetry@v2.0.0 with: poetry-version: 1.1.6 - name: Build fate_client run: | cd python/fate_client rm -f setup.py # clear README.rst echo "# fate client" > README.rst # bump fate client version poetry version ${{github.event.inputs.target}} # build package, saved in dist/ poetry build - name: List dist files run: ls -lh python/fate_client/dist/ python/fate_client/dist/ - name: Twine check run: | pip install -U twine twine check python/fate_client/dist/* - name: Upload to artifact uses: actions/upload-artifact@v2 with: path: | python/fate_client/dist/* - name: Test Install run: | pip install -U pip pip install python/fate_client/dist/fate_client-${{github.event.inputs.target}}.tar.gz - name: Upload to PyPI Test if: ${{ github.event.inputs.type == 'test' }} run: | twine upload --repository testpypi python/fate_client/dist/* --verbose env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.pypitest_token }} - name: Upload to PyPI if: ${{ github.event.inputs.type == 'release' }} run: | twine upload python/fate_client/dist/* --verbose env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.pypi_token }}