-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (38 loc) · 1.15 KB
/
package.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Publish to PyPI
on:
push:
branches: [ "hatch" ] #main can be added
release:
types: [published]
permissions:
contents: read
id-token: write # Ensure this permission is available for trusted publishing
jobs:
deploy:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: pip install hatch
- name: Build package
run: hatch build
- name: Test package
run: hatch -e test run nose2 --verbose
- name: Publish package distributions to Test PyPI
if: github.ref != 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
- name: Publish package distributions to PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://upload.pypi.org/legacy/