Skip to content

Commit

Permalink
add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaotian committed Feb 20, 2024
1 parent 6e41d56 commit 568b21a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Code Check
on: push

jobs:
check:
name: Code check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Check type
run: pnpm checktype

- name: Run tests
run: pnpm test
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- main
tags:
- v*
pull_request:

jobs:
release:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write
steps:
- name: Check out
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Check types
run: pnpm checktype

- name: Release
run: pnpm start-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
"build": "npm run build:lib && bunchee ./src/index.ts -m",
"build:lib": "rm -rf lib && tsc --project tsconfig.json",
"test": "pnpm build:lib && node --test",
"prepare": "is-ci || pnpm build && husky",
"checktype": "tsc --noEmit",
"start-publish": "pnpm test && npm publish --registry=https://registry.npmjs.org",
"push": "git lfs push --all origin"
"push": "git push && git lfs push --all origin",
"prepare": "is-ci || pnpm build && husky"
},
"dependencies": {
"ts-deepmerge": "^7.0.0"
Expand Down

0 comments on commit 568b21a

Please sign in to comment.