Publish all packages to PyPI and release to GitHub #4
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
# This publishes to PyPI. See: https://github.com/pypa/gh-action-pypi-publish | |
name: Publish all packages to PyPI and release to GitHub | |
on: | |
workflow_dispatch: null | |
workflow_call: null | |
jobs: | |
docs: | |
name: publish to PyPI | |
runs-on: ubuntu-latest | |
timeout-minutes: 6 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install twine wheel build | |
- name: Build and deploy wheels | |
env: | |
PYPI_API_KEY: ${{ secrets.PYPI_API_KEY }} | |
run: | | |
dev_tools/update-pypi-version.sh | |
release: | |
name: Publish release on GitHub | |
needs: docs | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 # allows workflow to access repo | |
- name: Set date for release title | |
run: echo today=$(date +"%B %d, %Y") >> $GITHUB_ENV # format date and append to env | |
- name: Set version number to most recent change | |
run: echo version=$(cat general-superstaq/general_superstaq/_version.py | grep -oP '[0-9\.]+') >> $GITHUB_ENV | |
- name: Create and publish release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: v${{ env.version }} | |
commit: ${{ github.sha }} | |
name: v${{ env.version }} ${{ env.today }} Release | |
generateReleaseNotes: true | |
makeLatest: true |