Skip to content

Commit

Permalink
ci: add semantic-release
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 committed Jun 21, 2024
1 parent 91d3a20 commit d6e5bf7
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Package and Release
on:
push:
branches:
- versioning-0 # TODO: use main
permissions:
contents: read # for checkout
jobs:
# TODO: uncomment this
#lint-and-test:
# uses: ./.github/workflows/lint-and-test.yml

release:
name: Publish Library
runs-on: large-8-core-32gb-22-04
# needs: [lint-and-test] # TODO: uncomment this
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 --dry-run # TODO: remove dry-run
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 Building $VERSION
72 changes: 72 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"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",
{
"assets": [
{
"path": "dist/*.h"
},
{
"path": "dist/*.so*"
},
{
"path": "dist/*.zip"
},
{
"path": "dist/*.tar.gz"
}
]
}
]
]
},
"dependencies": {
"@semantic-release/exec": "^6.0.3"
}
}

0 comments on commit d6e5bf7

Please sign in to comment.