Release new version #111
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: "Release new version" | |
on: | |
workflow_run: | |
workflows: | |
- "CI Tests" | |
branches: | |
- master | |
types: | |
- completed | |
jobs: | |
github: | |
name: "Create GitHub Release" | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Get Jupyter Workflow version" | |
run: echo "JF_VERSION=$(cat jupyter_workflow/version.py | grep -oP '(?<=VERSION = \")(.*)(?=\")')" >> $GITHUB_ENV | |
- name: "Check tag existence" | |
uses: mukunku/[email protected] | |
id: check-tag | |
with: | |
tag: ${{ env.JF_VERSION }} | |
- name: "Create Release" | |
id: create-release | |
uses: actions/create-release@v1 | |
if: ${{ steps.check-tag.outputs.exists == 'false' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.JF_VERSION }} | |
release_name: ${{ env.JF_VERSION }} | |
draft: false | |
prerelease: false | |
pypi: | |
name: "Publish on PyPI" | |
runs-on: ubuntu-22.04 | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: "Get Jupyter Workflow version" | |
run: echo "JF_VERSION=$(cat jupyter_workflow/version.py | grep -oP '(?<=VERSION = \")(.*)(?=\")')" >> $GITHUB_ENV | |
- name: "Get PyPI version" | |
run: echo "PYPI_VERSION=$(pip index versions --pre jupyter_workflow | grep jupyter_workflow | sed 's/.*(\(.*\))/\1/')" >> $GITHUB_ENV | |
- name: "Build Python packages" | |
if: ${{ env.JF_VERSION != env.PYPI_VERSION }} | |
run: | | |
python -m pip install build --user | |
python -m build --sdist --wheel --outdir dist/ . | |
- name: "Publish package to PyPI" | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: ${{ env.JF_VERSION != env.PYPI_VERSION }} |