Merge pull request #471 from test-fullautomation/HolQue/task/test_and… #26
Workflow file for this run
This file contains hidden or 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: Publish JsonPreprocessor to PyPI | |
| on: | |
| push: | |
| tags: | |
| - "rel/*.*.*" | |
| - "rel/*.*.*.*" | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Release Tag name for creating Github Release' | |
| required: false | |
| type: string | |
| jobs: | |
| build-n-publish: | |
| name: Build and publish to PyPI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4.3.0 | |
| with: | |
| python-version: "3.9" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y pandoc | |
| sudo apt-get install -y texlive-latex-* | |
| echo "GENDOC_LATEXPATH=$(dirname $(which pdflatex))" >> $GITHUB_ENV | |
| python -m pip install --upgrade build twine wheel GenPackageDoc PythonExtensionsCollection | |
| python -m pip install -r ./requirements.txt | |
| - name: Build source and wheel distributions | |
| run: | | |
| python setup.py sdist bdist_wheel | |
| twine check --strict dist/* | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| password: ${{ secrets.PYPI_API_TOKEN }} # This token should be created in Settings > Secrets > Actions | |
| # repository_url: https://test.pypi.org/legacy/ # Use this for testing to upload the distribution to test.pypi | |
| - name: Determine tag | |
| id: tag | |
| run: | | |
| TAG_NAME="" | |
| if [[ "${{ github.event.inputs.tag_name }}" != "" ]]; then | |
| TAG_NAME="${{ github.event.inputs.tag_name }}" | |
| elif [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| TAG_NAME="${GITHUB_REF#refs/tags/}" | |
| fi | |
| if [[ -z "$TAG_NAME" ]]; then | |
| echo "No valid tag provided. Skipping release." | |
| exit 0 | |
| else | |
| echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
| fi | |
| - name: Create/Update GitHub Release | |
| id: create_update_release | |
| if: env.TAG_NAME != '' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.TAG_NAME }} | |
| allowUpdates: true | |
| omitNameDuringUpdate: true | |
| makeLatest: true | |
| artifacts: dist/* |