Skip to content

Commit 94471d0

Browse files
authored
Merge pull request #40 from languitar/feature/automatic-releases
ci: add automatic releases with semantic release bot
2 parents f8bb576 + 1796823 commit 94471d0

File tree

5 files changed

+12162
-0
lines changed

5 files changed

+12162
-0
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@ name: CI build
22

33
on:
44
push:
5+
branches:
6+
- main
57
pull_request:
68
schedule:
79
- cron: '0 0 * * 0'
810

911
jobs:
12+
lint-commits:
13+
runs-on: ubuntu-latest
14+
if: ${{ github.event_name == 'pull_request' }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- uses: wagoid/commitlint-github-action@v2
20+
1021
lint-code:
1122
runs-on: ubuntu-latest
1223

@@ -62,3 +73,31 @@ jobs:
6273
uses: codecov/codecov-action@v1
6374
with:
6475
token: ${{ secrets.CODECOV_TOKEN }}
76+
77+
release:
78+
runs-on: ubuntu-latest
79+
if: ${{ github.ref == 'refs/heads/main' }}
80+
needs:
81+
- lint-code
82+
- lint-readme
83+
- test
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v2
87+
with:
88+
fetch-depth: 0
89+
- name: Setup Node.js
90+
uses: actions/setup-node@v1
91+
with:
92+
node-version: 16
93+
- name: Cache Node packages
94+
uses: actions/cache@v2
95+
with:
96+
path: node_modules
97+
key: release-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
98+
- name: Install dependencies
99+
run: npm ci
100+
- name: Release
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
run: npx semantic-release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/.coverage
99
/.python-version
1010
/.mypy_cache
11+
node_modules/

.releaserc.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"preset": "conventionalcommits"
8+
}
9+
],
10+
[
11+
"@semantic-release/release-notes-generator",
12+
{
13+
"preset": "angular"
14+
}
15+
],
16+
[
17+
"@google/semantic-release-replace-plugin",
18+
{
19+
"replacements": [
20+
{
21+
"files": ["setup.py"],
22+
"from": "version=\".*\"",
23+
"to": "version=\"${nextRelease.version}\"",
24+
"results": [
25+
{
26+
"file": "setup.py",
27+
"hasChanged": true,
28+
"numMatches": 1,
29+
"numReplacements": 1
30+
}
31+
],
32+
"countMatches": true
33+
}
34+
]
35+
}
36+
],
37+
[
38+
"@semantic-release/git",
39+
{
40+
"assets": ["setup.py"]
41+
}
42+
],
43+
"@semantic-release/github"
44+
]
45+
}

0 commit comments

Comments
 (0)