Release & Publish #22
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: Release & Publish | |
| on: | |
| push: | |
| # Sequence of patterns matched against refs/tags | |
| tags: | |
| - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
| workflow_dispatch: # Enables manual triggering from GH UI | |
| inputs: | |
| version: | |
| description: Manual Release & Publish | |
| default: release+publish | |
| required: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| permissions: | |
| contents: write # for softprops/action-gh-release to create GitHub release | |
| name: Create release & publish to PyPI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine jupyter urllib3 pandas pyyaml | |
| python -m build | |
| twine check --strict dist/* | |
| - name: Get the tag name | |
| run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
| - name: Determine draft status | |
| id: draft_status | |
| run: | | |
| if [[ "${GITHUB_REF}" == *"rc"* ]]; then | |
| echo "draft=true" >> $GITHUB_ENV | |
| else | |
| echo "draft=false" >> $GITHUB_ENV | |
| fi | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ github.ref }} | |
| draft: ${{ env.draft }} | |
| prerelease: ${{ env.draft }} | |
| body_path: tools/changelog.md | |
| - name: Publish distribution � to PyPI | |
| uses: pypa/gh-action-pypi-publish@master | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_PASSWORD }} |