-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2374 from jemrobinson/automate-pypi-release
Create GitHub Action to upload to PyPI on release
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 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,35 @@ | ||
--- | ||
name: Upload to PyPI | ||
|
||
# Run workflow on pushes to matching branches | ||
on: # yamllint disable-line rule:truthy | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build-and-publish-to-pypi: | ||
name: Build distribution and publish to PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/project/data-safe-haven/ | ||
permissions: | ||
id-token: write # needed for trusted publishing | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install hatch | ||
run: pip install hatch | ||
|
||
- name: Build with hatch | ||
run: hatch build | ||
|
||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |