From e701c1985c830360e331e645ca5267c30a546051 Mon Sep 17 00:00:00 2001 From: Sisyphus Bot Date: Thu, 12 Mar 2026 11:08:33 +0800 Subject: [PATCH] chore: add CI and semantic release workflow --- .github/workflows/ci.yml | 23 +++++++++++++++++ .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ .releaserc.json | 9 +++++++ 3 files changed, 80 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .releaserc.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d87d5fe --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + push: + branches: "*" + pull_request: + branches: "*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + - run: pnpm install + - run: pnpm run lint + - run: pnpm run test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1103198 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + branches: [main] + paths: + - "src/**" + - "package.json" + - ".github/workflows/release.yml" + +permissions: + contents: write + issues: write + pull-requests: write + id-token: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: pnpm/action-setup@v4 + with: + version: 10 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install + + - name: Build + run: pnpm run build + + - name: Run tests + run: pnpm run test + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true + run: npx semantic-release diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..8a27fd0 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,9 @@ +{ + "branches": ["main"], + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/npm", + "@semantic-release/github" + ] +}