diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..75ecfa0 --- /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: npm run build + + - name: Run tests + run: npm 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" + ] +} diff --git a/package.json b/package.json index bce8e5e..774cf74 100644 --- a/package.json +++ b/package.json @@ -41,9 +41,6 @@ "deploy": "npm run doc:gen && npm run build:demo && gh-pages -d dist", "test": "vitest run", "test:watch": "npm test -- --watch", - "preversion": "npm run build", - "postversion": "npm publish", - "postpublish": "git push --follow-tags && npm run deploy", "serve": "vite preview" }, "repository": {