Skip to content

Commit 1cd2374

Browse files
authored
Merge pull request #79 from mfisher87/automated-release
Publish to PyPI automatically when publishing a GitHub release
2 parents 161a6cb + d513594 commit 1cd2374

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
@@ -71,3 +71,13 @@ make typecheck
7171
```
7272

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

0 commit comments

Comments
 (0)