Skip to content

Commit 5c35c43

Browse files
committed
change release flow
1 parent cb8e135 commit 5c35c43

File tree

9 files changed

+235
-186
lines changed

9 files changed

+235
-186
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
# These are supported funding model platforms
2-
31
github: kazupon
4-
patreon: #
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
issuehunt: #
9-
custom: # Replace with a single custom sponsorship URL

.github/workflows/ci.yaml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
name: Lint
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
node: [18]
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- name: Checkout codes
21+
uses: actions/checkout@v4
22+
23+
- name: Enable corepack
24+
run: corepack enable
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: ${{ matrix.node }}
30+
cache: 'pnpm'
31+
32+
- name: Install
33+
run: pnpm install --no-frozen-lockfile
34+
35+
- name: Lint
36+
run: pnpm lint
37+
38+
build:
39+
name: Build
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest]
43+
node: [18, 20]
44+
runs-on: ${{ matrix.os }}
45+
steps:
46+
- name: Checkout codes
47+
uses: actions/checkout@v4
48+
49+
- name: Enable corepack
50+
run: corepack enable
51+
52+
- name: Setup Node
53+
uses: actions/setup-node@v3
54+
with:
55+
node-version: ${{ matrix.node }}
56+
cache: 'pnpm'
57+
58+
- name: Install
59+
run: pnpm install --no-frozen-lockfile
60+
61+
- name: Build
62+
run: pnpm build
63+
64+
test:
65+
name: Test
66+
strategy:
67+
matrix:
68+
os: [ubuntu-latest]
69+
node: [18, 20]
70+
runs-on: ${{ matrix.os }}
71+
steps:
72+
- name: Checkout codes
73+
uses: actions/checkout@v4
74+
75+
- name: Enable corepack
76+
run: corepack enable
77+
78+
- name: Setup Node
79+
uses: actions/setup-node@v3
80+
with:
81+
node-version: ${{ matrix.node }}
82+
cache: 'pnpm'
83+
84+
- name: Install
85+
run: pnpm install --no-frozen-lockfile
86+
87+
- name: Test
88+
run: pnpm test
89+
90+
edge-release:
91+
name: Edge Release
92+
needs:
93+
- lint
94+
- test
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: Checkout codes
98+
uses: actions/checkout@v4
99+
100+
- name: Enable corepack
101+
run: corepack enable
102+
103+
- name: Setup Node
104+
uses: actions/setup-node@v3
105+
with:
106+
node-version: 18
107+
cache: 'pnpm'
108+
109+
- name: Install
110+
run: pnpm install --no-frozen-lockfile
111+
112+
- name: Build
113+
run: pnpm build
114+
115+
- name: Release Edge
116+
if: |
117+
github.event_name == 'push' &&
118+
!startsWith(github.event.head_commit.message, '[skip-release]') &&
119+
!startsWith(github.event.head_commit.message, 'chore') &&
120+
!startsWith(github.event.head_commit.message, 'release') &&
121+
!startsWith(github.event.head_commit.message, 'docs')
122+
run: ./scripts/release.sh
123+
env:
124+
NPM_TOKEN: ${{secrets.NPM_ORG_TOKEN}}
125+
EDGE_RELEASE: 'true'

.github/workflows/lint.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- '**'
7+
tags:
8+
- 'v*'
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout codes
16+
uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.head_ref }}
19+
20+
- name: Enable corepack
21+
run: corepack enable
22+
23+
- name: Setup Node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: 18
27+
28+
- name: Extract version tag
29+
if: startsWith( github.ref, 'refs/tags/v' )
30+
uses: jungwinter/split@v2
31+
id: split
32+
with:
33+
msg: ${{ github.ref }}
34+
separator: '/'
35+
36+
- name: Create Github Release
37+
run: gh release create ${{ steps.split.outputs._2 }} --generate-notes
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Generate changelog
42+
run: |
43+
git restore --source=HEAD --staged --worktree -- package.json pnpm-lock.yaml
44+
pnpm install --no-frozen-lockfile
45+
pnpm build
46+
pnpm changelog --tag=${{ steps.split.outputs._2 }}
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Commit changelog
51+
uses: stefanzweifel/git-auto-commit-action@v4
52+
with:
53+
branch: main
54+
file_pattern: 'CHANGELOG.md'
55+
commit_message: 'chore: sync changelog'
56+
57+
- name: Publish package
58+
run: ./scripts/release.sh
59+
env:
60+
NPM_TOKEN: ${{secrets.NPM_ORG_TOKEN}}

.github/workflows/test.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@
1717
"bugs": {
1818
"url": "https://github.com/intlify/cli/issues"
1919
},
20-
"changelog": {
21-
"labels": {
22-
"Type: Feature": ":star: Features",
23-
"Type: Bug": ":bug: Bug Fixes",
24-
"Type: Security": ":lock: Security Fixes",
25-
"Type: Performance": ":chart_with_upwards_trend: Performance Fixes",
26-
"Type: Improvement": ":zap: Improvement Features",
27-
"Type: Breaking": ":boom: Breaking Change",
28-
"Type: Deprecated": ":warning: Deprecated Features",
29-
"Type: I18n": ":globe_with_meridians: Internationalization",
30-
"Type: A11y": ":wheelchair: Accessibility",
31-
"Type: Documentation": ":pencil: Documentation"
32-
}
33-
},
3420
"dependencies": {
3521
"@intlify/bundle-utils": "^7.3.0",
3622
"@intlify/core": "^9.4.1",
@@ -52,7 +38,6 @@
5238
},
5339
"devDependencies": {
5440
"@intlify/eslint-plugin-vue-i18n": "^3.0.0-next.3",
55-
"@kazupon/lerna-changelog": "^4.3.0",
5641
"@microsoft/api-extractor": "^7.37.0",
5742
"@secretlint/secretlint-rule-preset-recommend": "^3.3.0",
5843
"@types/debug": "^4.1.8",
@@ -65,6 +50,8 @@
6550
"@typescript-eslint/parser": "^6.7.0",
6651
"@vitest/coverage-v8": "^0.34.4",
6752
"api-docs-gen": "^0.3.0",
53+
"bumpp": "^9.2.0",
54+
"gh-changelogen": "^0.2.8",
6855
"eslint": "^8.49.0",
6956
"eslint-config-prettier": "^9.0.0",
7057
"eslint-plugin-prettier": "^5.0.0",
@@ -73,7 +60,6 @@
7360
"npm-run-all": "^4.1.5",
7461
"opener": "^1.5.2",
7562
"secretlint": "^3.3.0",
76-
"shipjs": "^0.24.4",
7763
"typescript": "^5.2.2",
7864
"unbuild": "^1.2.1",
7965
"vitest": "^0.34.4"
@@ -118,6 +104,8 @@
118104
"packageManager": "pnpm@8.7.5",
119105
"scripts": {
120106
"prepare": "git config --local core.hooksPath .githooks",
107+
"changelog": "gh-changelogen --repo=@intlify/cli",
108+
"release": "bumpp --commit \"release: v%s\" --push --tag",
121109
"build": "pnpm build:transpile && pnpm build:extract",
122110
"build:extract": "api-extractor run -l -c ./api-extractor.json",
123111
"build:transpile": "unbuild",
@@ -132,8 +120,6 @@
132120
"lint:eslint": "eslint ./src ./test --ext .ts",
133121
"lint:eslint:fix": "pnpm lint:eslint --fix",
134122
"lint:secret": "npx secretlint \"**/*\"",
135-
"release:prepare": "shipjs prepare",
136-
"release:trigger": "shipjs trigger",
137123
"test": "pnpm test:type && pnpm test:cover",
138124
"test:type": "tsc -p . --noEmit",
139125
"test:cover": "pnpm test:unit --coverage",

scripts/bump-edge.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { execSync } from 'node:child_process'
2+
import { promises as fs } from 'node:fs'
3+
import { resolve } from 'node:path'
4+
5+
async function main() {
6+
const commit = execSync('git rev-parse --short HEAD').toString('utf-8').trim()
7+
const date = Math.round(Date.now() / (1000 * 60))
8+
9+
const pkgPath = resolve(process.cwd(), 'package.json')
10+
const pkg = JSON.parse(await fs.readFile(pkgPath, 'utf-8').catch(() => '{}'))
11+
pkg.version = `${pkg.version}-${date}.${commit}`
12+
pkg.name = pkg.name + '-edge'
13+
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
14+
}
15+
16+
main().catch(err => {
17+
console.error(err)
18+
process.exit(1)
19+
})

scripts/release.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set -xe
4+
5+
if [[ ! -z ${PNPM_INSTALL} ]] ; then
6+
# Restore all git changes
7+
git restore --source=HEAD --staged --worktree -- package.json pnpm-lock.yaml
8+
# Install pnpm
9+
pnpm install --no-frozen-lockfile
10+
fi
11+
12+
# Check edge release
13+
if [[ ! -z ${EDGE_RELEASE} ]] ; then
14+
npx jiti ./scripts/bump-edge
15+
fi
16+
17+
# Update token
18+
if [[ ! -z ${NPM_TOKEN} ]] ; then
19+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
20+
echo "registry=https://registry.npmjs.org/" >> ~/.npmrc
21+
echo "always-auth=true" >> ~/.npmrc
22+
npm whoami
23+
fi
24+
25+
# Release packages
26+
echo "Publishing"
27+
npm publish

0 commit comments

Comments
 (0)