release #9
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 | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'tag to create and push, of the form "X.Y.Z"' | |
required: true | |
type: string | |
defaults: | |
run: | |
working-directory: python | |
jobs: | |
build-and-release: | |
# Since we only make pure python wheels and source, | |
# we only need to build on one platform. | |
runs-on: ubuntu-latest | |
permissions: | |
# Needed for trusted publishing to PyPI | |
id-token: write | |
# Needed for pushing commit and tags | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
- name: Install Hatch | |
run: pip install --upgrade hatch | |
- name: bump version, commit, tag, and push | |
run: | | |
echo "__version__ = \"${{ inputs.release }}\"" > src/nicknames/_version.py | |
git config user.name "NickCrews" | |
git config user.email "[email protected]" | |
git add src/nicknames/_version.py | |
git commit -m "Bump version to ${{ inputs.release }}" | |
git tag -a "v${{ inputs.release }}" -m "Release ${{ inputs.release }}" | |
git push | |
git push origin "v${{ inputs.release }}" | |
- name: Build sdist and wheel | |
run: hatch build | |
- name: Push build artifacts to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
packages-dir: python/dist |