Skip to content

Commit

Permalink
ci: add semantic-release (#24)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dalbertom authored Jun 23, 2024
1 parent 37f93f6 commit 650ac2a
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: CI-Lint-And-Test

on:
push:
branches:
- main
workflow_call:
pull_request:
types: [opened, synchronize, reopened]

Expand Down Expand Up @@ -137,4 +135,3 @@ jobs:
cargo install cargo-udeps --locked
- name: Run cargo udeps
run: cargo +nightly udeps --all-targets

37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release
on:
push:
branches:
- main
permissions:
contents: read # for checkout
jobs:
lint-and-test:
uses: ./.github/workflows/lint-and-test.yml

release:
name: Release
runs-on: large-8-core-32gb-22-04
needs: [lint-and-test]
environment: deploy #!! DO NOT CHANGE THIS LINE !! #
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # download tags, see https://github.com/actions/checkout/issues/100
- run: git config --global --add safe.directory $(realpath .)
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "20.x"
- name: Semantic Release
run: |
npm install semantic-release
npx semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} #TODO: add CRATES_TOKEN
4 changes: 4 additions & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

VERSION=${1?expected version as argument}
echo "Would build version $VERSION, but publishing is manual for now"
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "proof_of_sql",
"version": "0.0.0-development",
"devDependencies": {
"conventional-changelog-conventionalcommits": "^5.0.0",
"semantic-release": "^21.0.5"
},
"release": {
"branches": [
"main"
],
"tagFormat": "v${version}",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalCommits",
"releaseRules": [
{ "breaking": true, "release": "minor" },
{ "revert": true, "release": "patch" },
{ "type": "feat", "release": "patch" },
{ "type": "fix", "release": "patch" },
{ "type": "build", "release": "patch" },
{ "type": "docs", "release": "patch" },
{ "type": "chore", "release": "patch" },
{ "type": "bench", "release": "patch" },
{ "type": "perf", "release": "patch" },
{ "type": "refactor", "release": "patch" },
{ "type": "test", "release": "patch" },
{ "type": "ci", "release": "patch" }
],
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
}
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"prepareCmd": "bash ./ci/build.sh ${nextRelease.version}"
}
],
[
"@semantic-release/github"
]
]
},
"dependencies": {
"@semantic-release/exec": "^6.0.3"
}
}

0 comments on commit 650ac2a

Please sign in to comment.