Skip to content

Commit a3de1ef

Browse files
add deploy to github actions
1 parent b7f2330 commit a3de1ef

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/test.yaml renamed to .github/workflows/test_and_deploy.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Test
33
on:
44
push:
55
branches: [main]
6+
tags:
7+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
68
pull_request:
79
branches: [main]
810

@@ -76,3 +78,29 @@ jobs:
7678
with:
7779
name: coverage
7880
verbose: true
81+
deploy:
82+
# this will run when you have tagged a commit, starting with "v*"
83+
# and requires that you have put your twine API key in your
84+
# github secrets (see readme for details)
85+
needs: [test]
86+
runs-on: ubuntu-latest
87+
if: contains(github.ref, 'tags')
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v3
91+
92+
- name: Set up Python 3.10
93+
uses: actions/setup-python@v4
94+
with:
95+
python-version: "3.10"
96+
97+
- name: Install hatch
98+
run: pip install hatch
99+
100+
- name: Build project for distribution
101+
run: hatch build
102+
103+
- name: Publish a Python distribution to PyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1
105+
with:
106+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)