Skip to content

Commit

Permalink
fix: add the ci & release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
chengkai48 committed Jul 24, 2024
1 parent 622deaa commit 043d64a
Show file tree
Hide file tree
Showing 15 changed files with 2,071 additions and 287 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm

- run: pnpm i -g @antfu/ni
- run: nci
- run: nr lint
- run: nr typecheck

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node: [lts/*]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm

- run: pnpm i -g @antfu/ni
- run: nci
- run: nr build
- run: nr test
30 changes: 15 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ on:
jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Node.js
uses: actions/setup-node@v2
- uses: actions/checkout@v4
with:
node-version: '18'
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: pnpm install
- run: pnpm dlx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Run tests
run: pnpm test
# Uncomment the following lines to publish to npm on CI

- name: Release
- run: pnpm install
- run: pnpm publish -r --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx release-it
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
21 changes: 21 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://unpkg.com/release-it/schema/release-it.json",
"github": {
"release": true
},
"git": {
"commitMessage": "chore(release): release v${version}",
"tagName": "v${version}",
"requireCleanWorkingDir": false
},
"npm": {
"publish": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md",
"ignoreRecommendedBump": true
}
}
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prepare": "simple-git-hooks",
"test": "vitest"
"test": "vitest",
"release": "release-it"
},
"dependencies": {
"vue": "^3.4.31"
},
"devDependencies": {
"@antfu/eslint-config": "^2.23.2",
"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^20.14.12",
"@vitejs/plugin-vue": "^5.0.5",
"eslint": "9.5.0",
"lint-staged": "^15.2.7",
"release-it": "^17.6.0",
"simple-git-hooks": "^2.11.1",
"typescript": "^5.2.2",
"vite": "^5.3.4",
Expand Down
Loading

0 comments on commit 043d64a

Please sign in to comment.