Skip to content

Commit d513594

Browse files
committed
Publish to PyPI automatically when publishing a GitHub release
1 parent 6735c7e commit d513594

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

.github/workflows/check.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: "Check with pre-commit"
22
on:
3-
- "push"
4-
- "pull_request"
3+
push:
4+
branches: ["main"]
5+
pull_request:
56

67
jobs:
78

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Release"
2+
on:
3+
release:
4+
types:
5+
- "published"
6+
7+
jobs:
8+
9+
build-and-release:
10+
runs-on: "ubuntu-latest"
11+
steps:
12+
- uses: "actions/checkout@v3"
13+
14+
- name: "Set up Python"
15+
uses: "actions/setup-python@v4"
16+
with:
17+
python-version: "3.9"
18+
19+
- name: "Install build tool"
20+
run: "pip install --user build"
21+
22+
- name: "Build binary dist (wheel) and source dist"
23+
run: "python -m build"
24+
25+
- name: "Publish to PyPI"
26+
uses: "pypa/gh-action-pypi-publish@release/v1"
27+
with:
28+
password: "${{ secrets.PYPI_TOKEN }}"
29+
repository-url: "https://pypi.org/project/viscm"

.github/workflows/test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
name: "Unit test"
1+
name: "Test"
22
on:
3-
- "push"
4-
- "pull_request"
3+
push:
4+
branches: ["main"]
5+
pull_request:
56

67
jobs:
78

doc/contributing.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,13 @@ make typecheck
6969
```
7070

7171
Type checking requires `mypy`.
72+
73+
74+
## Making a release and publishing to PyPI
75+
76+
Create a release using the GitHub user interface. Tag the version following
77+
[semver](https://semver.org). *NOTE: As this software is pre-1.x, always increment the
78+
minor version only.*
79+
80+
Once the release is published in GitHub, a GitHub Action will be triggered to build and
81+
upload to PyPI.

0 commit comments

Comments
 (0)