-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add semantic release and PyPi upload (#2)
- Loading branch information
Showing
3 changed files
with
112 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Config file for semantic-prs (https://github.com/Ezard/semantic-prs). | ||
--- | ||
# PRs will be rebased before being merged. Individual commits need to | ||
# follow the semantic PR spec. | ||
commitsOnly: true |
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 |
---|---|---|
|
@@ -6,6 +6,8 @@ on: | |
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
validate: | ||
|
@@ -17,12 +19,58 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- run: python -m pip install hatch | ||
- run: hatch fmt --check | ||
- run: hatch test | ||
- run: hatch run types:check | ||
|
||
semantic_release: | ||
name: "semantic release" | ||
runs-on: ubuntu-latest | ||
|
||
if: github.event_name == 'push' | ||
|
||
# Make sure tests pass before running. | ||
needs: | ||
- validate | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
# `python-semantic-release` will run `hatch build`. | ||
- run: python -m pip install hatch | ||
- uses: python-semantic-release/[email protected] | ||
|
||
pypi: | ||
name: "publish to PyPi" | ||
runs-on: ubuntu-latest | ||
|
||
if: github.event_name == 'release' | ||
|
||
needs: | ||
- validate | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
- run: python -m pip install hatch | ||
# Tests should have already run in the `validate` job; just run | ||
# them again as a sanity check. | ||
- run: hatch test | ||
- run: hatch build | ||
- run: hatch publish | ||
env: | ||
HATCH_INDEX_USER: __token__ | ||
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }} |
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