Skip to content

Commit 8e31b39

Browse files
committed
Add CI/CD workflow, update release process, and configure linting for API package
1 parent 84f6496 commit 8e31b39

File tree

7 files changed

+1351
-1268
lines changed

7 files changed

+1351
-1268
lines changed

.github/workflows/cicd.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
paths:
6+
- "packages/**"
7+
- "turbo.json"
8+
- "package.json"
9+
branches:
10+
- main
11+
- next
12+
13+
jobs:
14+
CI:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: pnpm/action-setup@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version-file: '.nvmrc'
22+
cache: 'pnpm'
23+
- run: pnpm install --frozen-lockfile
24+
- run: pnpm run lint:lib
25+
- run: pnpm run test:lib
26+
27+
CD:
28+
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' }}
29+
runs-on: ubuntu-latest
30+
needs: [CI]
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: pnpm/action-setup@v4
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version-file: '.nvmrc'
37+
cache: 'pnpm'
38+
- run: pnpm install --frozen-lockfile
39+
- run: pnpm run build:lib
40+
- name: Release
41+
env:
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
run: pnpm run release:lib

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
"packageManager": "[email protected]",
55
"scripts": {
66
"build": "turbo run build",
7+
"lint:lib": "turbo run lint --filter=@yme/api",
78
"test:lib": "turbo run test --filter=@yme/api",
8-
"build:lib": "turbo run build --filter=@yme/api"
9+
"build:lib": "turbo run build --filter=@yme/api",
10+
"release:lib": "turbo run release --filter=@yme/api"
911
},
1012
"devDependencies": {
1113
"@biomejs/biome": "^1.8.3",

packages/api/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@yme/api",
33
"description": "define type-safe API requests simply",
4-
"version": "2.0.0-alpha.13",
4+
"version": "0.0.0-development",
55
"type": "module",
66
"sideEffects": false,
77
"author": "mino",
@@ -40,23 +40,23 @@
4040
"clean": "rm -rf node_modules dist",
4141
"build": "rm -rf dist && tsc -p tsconfig.build.json && publint --strict",
4242
"prepublishOnly": "npm run build",
43-
"release": "np",
43+
"release": "semantic-release",
4444
"test": "bun test --coverage",
4545
"lint": "biome lint",
4646
"format": "biome format --write ."
4747
},
4848
"publishConfig": {
49-
"access": "public",
50-
"tag": "next"
49+
"access": "public"
5150
},
5251
"devDependencies": {
5352
"@size-limit/preset-small-lib": "^11.1.6",
5453
"@types/bun": "^1.1.8",
5554
"@types/node": "^22.5.4",
55+
"conventional-changelog-conventionalcommits": "^8.0.0",
5656
"next": "^14.2.15",
5757
"node-mocks-http": "^1.16.1",
58-
"np": "^10.0.7",
5958
"publint": "^0.2.10",
59+
"semantic-release": "^24.2.0",
6060
"size-limit": "^11.1.6",
6161
"typescript": "^5.5.4",
6262
"zod": "^3.23.8"

packages/api/release.config.cjs

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/**
2+
* @type {import('semantic-release').GlobalConfig}
3+
*/
4+
module.exports = {
5+
branches: [
6+
'master',
7+
'main',
8+
{ name: 'next', channel: 'next', prerelease: true },
9+
{ name: 'alpha', prerelease: 'alpha', channel: 'alpha' },
10+
{ name: 'beta', prerelease: 'beta', channel: 'beta' },
11+
],
12+
plugins: [
13+
['@semantic-release/commit-analyzer', {
14+
preset: 'conventionalcommits',
15+
releaseRules: [
16+
{ release: 'major', breaking: true },
17+
{ release: 'minor', type: 'feat' },
18+
{ release: 'patch', revert: true },
19+
{ release: 'patch', type: 'build' },
20+
{ release: 'patch', type: 'fix' },
21+
{ release: 'patch', type: 'perf' },
22+
{ release: 'patch', type: 'refactor' },
23+
{ type: 'ci', release: false },
24+
{ type: 'docs', release: false },
25+
{ type: 'chore', release: false },
26+
{ type: 'test', release: false },
27+
{ type: 'style', release: false },
28+
{ subject: '*skip release*', release: false },
29+
],
30+
parserOpts: {
31+
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES"]
32+
}
33+
}],
34+
['@semantic-release/release-notes-generator', {
35+
preset: 'conventionalcommits',
36+
presetConfig: {
37+
types: [
38+
{
39+
type: "revert",
40+
section: "Reverts",
41+
hidden: false,
42+
},
43+
{
44+
type: "feat",
45+
section: "Features",
46+
hidden: false,
47+
},
48+
{
49+
type: "fix",
50+
section: "Bug Fixes",
51+
hidden: false,
52+
},
53+
{
54+
type: "perf",
55+
section: "Performance improvements",
56+
hidden: false,
57+
},
58+
{
59+
type: "refactor",
60+
section: "Refactors",
61+
hidden: false,
62+
},
63+
{
64+
type: "build",
65+
section: "Build System",
66+
hidden: false,
67+
},
68+
{
69+
type: "docs",
70+
section: "Documentation",
71+
hidden: false,
72+
},
73+
{ type: "chore", hidden: true },
74+
{ type: "test", hidden: true },
75+
{ type: "ci", hidden: true },
76+
{ type: "style", hidden: true },
77+
]
78+
},
79+
parserOpts: {
80+
noteKeywords: ["BREAKING CHANGE", "BREAKING CHANGES"]
81+
}
82+
}],
83+
['@semantic-release/npm'],
84+
['@semantic-release/github']
85+
]
86+
}

0 commit comments

Comments
 (0)