Skip to content

Commit 650ac2a

Browse files
authored
ci: add semantic-release (#24)
Since we want to use 0.x.y versions for now, we modify the behavior via releaseRules, e.g. * breaking is set to minor release (by default it's major) * feat is set to patch (by default it's minor) Once we release v1.0.0 we should reset these to their intended behavior.
1 parent 37f93f6 commit 650ac2a

File tree

4 files changed

+98
-4
lines changed

4 files changed

+98
-4
lines changed

.github/workflows/lint-and-test.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: CI-Lint-And-Test
22

33
on:
4-
push:
5-
branches:
6-
- main
4+
workflow_call:
75
pull_request:
86
types: [opened, synchronize, reopened]
97

@@ -137,4 +135,3 @@ jobs:
137135
cargo install cargo-udeps --locked
138136
- name: Run cargo udeps
139137
run: cargo +nightly udeps --all-targets
140-

.github/workflows/release.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: read # for checkout
8+
jobs:
9+
lint-and-test:
10+
uses: ./.github/workflows/lint-and-test.yml
11+
12+
release:
13+
name: Release
14+
runs-on: large-8-core-32gb-22-04
15+
needs: [lint-and-test]
16+
environment: deploy #!! DO NOT CHANGE THIS LINE !! #
17+
permissions:
18+
contents: write # to be able to publish a GitHub release
19+
issues: write # to be able to comment on released issues
20+
pull-requests: write # to be able to comment on released pull requests
21+
id-token: write # to enable use of OIDC for npm provenance
22+
steps:
23+
- uses: actions/[email protected]
24+
with:
25+
fetch-depth: 0 # download tags, see https://github.com/actions/checkout/issues/100
26+
- run: git config --global --add safe.directory $(realpath .)
27+
- name: Setup node
28+
uses: actions/setup-node@v3
29+
with:
30+
node-version: "20.x"
31+
- name: Semantic Release
32+
run: |
33+
npm install semantic-release
34+
npx semantic-release
35+
env:
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
#CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} #TODO: add CRATES_TOKEN

ci/build.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
VERSION=${1?expected version as argument}
4+
echo "Would build version $VERSION, but publishing is manual for now"

package.json

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "proof_of_sql",
3+
"version": "0.0.0-development",
4+
"devDependencies": {
5+
"conventional-changelog-conventionalcommits": "^5.0.0",
6+
"semantic-release": "^21.0.5"
7+
},
8+
"release": {
9+
"branches": [
10+
"main"
11+
],
12+
"tagFormat": "v${version}",
13+
"plugins": [
14+
[
15+
"@semantic-release/commit-analyzer",
16+
{
17+
"preset": "conventionalCommits",
18+
"releaseRules": [
19+
{ "breaking": true, "release": "minor" },
20+
{ "revert": true, "release": "patch" },
21+
{ "type": "feat", "release": "patch" },
22+
{ "type": "fix", "release": "patch" },
23+
{ "type": "build", "release": "patch" },
24+
{ "type": "docs", "release": "patch" },
25+
{ "type": "chore", "release": "patch" },
26+
{ "type": "bench", "release": "patch" },
27+
{ "type": "perf", "release": "patch" },
28+
{ "type": "refactor", "release": "patch" },
29+
{ "type": "test", "release": "patch" },
30+
{ "type": "ci", "release": "patch" }
31+
],
32+
"parserOpts": {
33+
"noteKeywords": [
34+
"BREAKING CHANGE",
35+
"BREAKING CHANGES",
36+
"BREAKING"
37+
]
38+
}
39+
}
40+
],
41+
"@semantic-release/release-notes-generator",
42+
[
43+
"@semantic-release/exec",
44+
{
45+
"prepareCmd": "bash ./ci/build.sh ${nextRelease.version}"
46+
}
47+
],
48+
[
49+
"@semantic-release/github"
50+
]
51+
]
52+
},
53+
"dependencies": {
54+
"@semantic-release/exec": "^6.0.3"
55+
}
56+
}

0 commit comments

Comments
 (0)