Skip to content

Commit

Permalink
fix(semantic-release): add semantic release and commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
morewings committed Apr 20, 2024
1 parent cbea74c commit 739b623
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
29 changes: 18 additions & 11 deletions .github/workflows/merge-jobs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Post-merge tasks
name: Release

on:
push:
Expand All @@ -11,16 +11,23 @@ jobs:
build-publish:

runs-on: ubuntu-latest
# 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:
- name: Checkout
uses: actions/checkout@v4

- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
Expand All @@ -31,7 +38,7 @@ jobs:
node-version: ${{ steps.nvm.outputs.NVMRC }}

- name: Install pnpm
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
Expand All @@ -48,11 +55,11 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Run merge tasks
- name: Build and publish NPM package
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm install
# - name: Publish NPM package
# uses: JS-DevTools/npm-publish@v3
# with:
# token: ${{ secrets.NPM_TOKEN }}
pnpm run build
pnpm run semantic-release
6 changes: 3 additions & 3 deletions .github/workflows/pull-request-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v4

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"test": "jest",
"preview": "vite preview",
"prepare": "is-ci || husky",
"lint-staged": "lint-staged"
"lint-staged": "lint-staged",
"commitlint": "commitlint"
},
"peerDependencies": {
"react": ">=18.2.0",
Expand Down
18 changes: 18 additions & 0 deletions release.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @type {import('semantic-release').GlobalConfig}
*/
module.exports = {
branches: ['master'],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/npm',
[
'@semantic-release/git',
{
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
'@semantic-release/github',
],
};
1 change: 1 addition & 0 deletions tsconfig.linter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"**/*.stories.ts",
"*.config.ts",
"*.config.js",
"release.config.cjs",
"src",
".eslintrc.cjs",
"templates/**/*.ts",
Expand Down

0 comments on commit 739b623

Please sign in to comment.