Skip to content

Commit 5a92146

Browse files
committed
ci: add semantic-release to this repo
Signed-off-by: ffyuanda <[email protected]>
1 parent 8cc529c commit 5a92146

File tree

4 files changed

+64
-4
lines changed

4 files changed

+64
-4
lines changed

.github/workflows/release.yml

+32-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
run: |
6868
python -m unittest discover -s tests -t tests
6969
70-
coverall:
70+
coveralls:
7171
runs-on: ubuntu-latest
7272
steps:
7373
- name: Checkout
@@ -98,4 +98,34 @@ jobs:
9898
- name: Upload coverage data to coveralls.io
9999
run: coveralls --service=github
100100
env:
101-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
103+
release:
104+
name: Release
105+
runs-on: ubuntu-latest
106+
needs: [ tests, coveralls ]
107+
steps:
108+
- name: Checkout
109+
uses: actions/checkout@v2
110+
with:
111+
fetch-depth: 0
112+
113+
- name: Setup Node.js
114+
uses: actions/setup-node@v1
115+
116+
- name: Setup
117+
run: npm install -g semantic-release @semantic-release/github @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/git @semantic-release/release-notes-generator semantic-release-pypi
118+
119+
- name: Set up python
120+
uses: actions/setup-python@v2
121+
with:
122+
python-version: 3.8
123+
124+
- name: Install setuptools
125+
run: python -m pip install --upgrade setuptools wheel twine
126+
127+
- name: Release
128+
env:
129+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
131+
run: npx semantic-release

.releaserc.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"branches": "master",
3+
"plugins": [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
"semantic-release-pypi",
7+
"@semantic-release/github",
8+
[
9+
"@semantic-release/changelog",
10+
{
11+
"changelogFile": "CHANGELOG.md",
12+
"changelogTitle": "# Semantic Versioning Changelog"
13+
}
14+
],
15+
[
16+
"@semantic-release/git",
17+
{
18+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
19+
"assets": ["CHANGELOG.md", "setup.py", "setup.cfg"]
20+
}
21+
]
22+
]
23+
}

setup.cfg

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[bdist_wheel]
2+
universal = 1
3+
4+
[metadata]
5+
description-file = README.md
6+
version = 0.0.1

setup.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from setuptools import setup, find_packages
1+
from setuptools import setup, find_packages, __version__
2+
23

34
with open("README.md", "r") as readme_file:
45
readme = readme_file.read()
@@ -20,4 +21,4 @@
2021
"Programming Language :: Python :: 3.8",
2122
"License :: OSI Approved :: Apache Software License",
2223
],
23-
)
24+
)

0 commit comments

Comments
 (0)