Skip to content

Commit

Permalink
chore(semantic-release): initial config
Browse files Browse the repository at this point in the history
  • Loading branch information
dorayx committed Sep 2, 2023
1 parent f802047 commit 33a5921
Show file tree
Hide file tree
Showing 5 changed files with 3,198 additions and 285 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish to NPM Packages

on:
workflow_dispatch:
## Uncomment the following lines to trigger the workflow on push
# push:
# branches:
# - main
# - next

jobs:
release:
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:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'
- run: yarn install
- run: yarn test
- run: yarn build
- run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22 changes: 22 additions & 0 deletions .releaserc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
branches: ['main', { name: 'next', channel: 'next' }, { name: 'dev', channel: 'dev', prerelease: true }],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogFile: 'docs/CHANGELOG.md',
},
],
'semantic-release-yarn',
'@semantic-release/github',

[
'@semantic-release/git',
{
assets: ['docs/CHANGELOG.md'],
},
],
],
};
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ and so I've created this repo as a starting point for my future projects.
**Code Generator**

- [Plop](https://plopjs.com/)

**Publish**

- [semantic-release](https://semantic-release.gitbook.io/)
- GitHub Action: `.github/workflows/release-package.yml`
- Env Variables: `NPM_TOKEN` is required to publish a package to the npm registry
- Additional Plugin: [semantic-release-yarn](https://github.com/hongaar/semantic-release-yarn)
- Additional Plugin: [@semantic-release/changelog](https://github.com/semantic-release/changelog)
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "template-typescript",
"name": "@dillage/testing-template-typescript",
"version": "0.0.0",
"author": "Doray <open@doray.dev>",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/dorayx/template-typescript.git"
},
"files": [
"dist"
],
Expand All @@ -22,11 +26,14 @@
"test:dev": "vitest dev",
"coverage": "vitest run --coverage",
"postinstall": "is-ci || husky install",
"plop": "plop"
"plop": "plop",
"semantic-release": "semantic-release"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/node": "^20.5.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
Expand All @@ -37,6 +44,8 @@
"lint-staged": "^14.0.1",
"plop": "^3.1.2",
"prettier": "3.0.2",
"semantic-release": "^21.1.1",
"semantic-release-yarn": "^2.0.1",
"typescript": "~5.1.0",
"vite": "^4.4.5",
"vite-plugin-dts": "^3.5.3",
Expand Down
Loading

0 comments on commit 33a5921

Please sign in to comment.