-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize release workflow use most recent tool (#291)
* modernize release workflow * fix file path
- Loading branch information
Showing
1 changed file
with
28 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,39 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
pull_request: | ||
paths: | ||
- .github/workflows/release.yml | ||
|
||
jobs: | ||
release: | ||
# requires that you have put your twine API key in your | ||
# github secrets (see readme for details) | ||
runs-on: ubuntu-latest | ||
if: contains(github.ref, 'tags') | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
- uses: actions/checkout@v4 | ||
- uses: hynek/build-and-inspect-python-package@v2 | ||
- name: determine tag | ||
run: echo "tag=${GITHUB_REF/refs\/tags\/v/}" >> "$GITHUB_ENV" | ||
- name: Create Release | ||
uses: "softprops/action-gh-release@v2" | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
tag_name: ${{ github.ref }} | ||
name: ${{ env.tag }} | ||
draft: false | ||
prerelease: ${{ contains(env.tag, 'rc') || contains(env.tag, 'a') || contains(env.tag, 'b') }} | ||
target_commitish: ${{ github.sha }} | ||
files: | | ||
dist/* | ||
- name: Publish PyPI Package | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
python-version: "3.x" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U setuptools setuptools_scm wheel twine build | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} | ||
run: | | ||
git tag | ||
python -m build . | ||
twine upload dist/* | ||
password: ${{ secrets.TWINE_API_KEY }} |