Skip to content

Commit e38b3a3

Browse files
committed
fix: gh actions for lint and release
1 parent 239053b commit e38b3a3

2 files changed

Lines changed: 94 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
format:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: pnpm/action-setup@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 22
17+
cache: 'pnpm'
18+
19+
- run: pnpm install --frozen-lockfile
20+
- run: pnpm format:check
21+
22+
lint:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- uses: pnpm/action-setup@v4
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
cache: 'pnpm'
31+
32+
- run: pnpm install --frozen-lockfile
33+
- run: pnpm lint
34+
35+
test:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: pnpm/action-setup@v4
40+
- uses: actions/setup-node@v4
41+
with:
42+
node-version: 22
43+
cache: 'pnpm'
44+
45+
- run: pnpm install --frozen-lockfile
46+
- run: pnpm test

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release Package
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
create-github-release:
10+
permissions:
11+
contents: write
12+
runs-on: ubuntu-latest
13+
if: startsWith(github.ref, 'refs/tags/v')
14+
steps:
15+
- name: Calculate release name
16+
run: |
17+
GITHUB_REF=${{ github.ref }}
18+
RELEASE_NAME=${GITHUB_REF#"refs/tags/"}
19+
echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_ENV
20+
21+
- name: Publish release
22+
uses: actions/create-release@v1
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
with:
26+
tag_name: ${{ github.ref }}
27+
release_name: ${{ env.RELEASE_NAME }}
28+
draft: false
29+
prerelease: false
30+
31+
publish-npm-release:
32+
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
35+
id-token: write
36+
steps:
37+
- uses: actions/checkout@v4
38+
- uses: pnpm/action-setup@v4
39+
- uses: actions/setup-node@v4
40+
with:
41+
node-version: 22
42+
cache: 'pnpm'
43+
registry-url: 'https://registry.npmjs.org'
44+
45+
- run: pnpm install --frozen-lockfile
46+
- run: npm publish --provenance --access public
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)