From f4557b3ac7bbfca150af029f657ddbc3fa0fabb4 Mon Sep 17 00:00:00 2001 From: Nikita Aleksov Date: Sat, 1 Aug 2026 16:34:45 +0400 Subject: [PATCH] ci: add release workflow --- .github/workflows/release.yml | 85 +++++++++++++++++++++++++++++++++++ packages/lib/package.json | 2 +- 2 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..441bdbe --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: release +on: + push: + branches: + - main + pull_request: + types: + - closed + branches: + - main + workflow_dispatch: null +permissions: {} + +jobs: + pr: + if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', + github.event.repository.default_branch) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: danielroe/uppt/pr@3a4fd445ce266b91dd73ced7ae8140cc0f9fc19c + with: + token: ${{ secrets.GITHUB_TOKEN }} + packages: | + packages/* + !packages/playground + + release: + if: | + github.event_name == 'pull_request' + && github.event.pull_request.merged == true + && startsWith(github.event.pull_request.head.ref, 'release/v') + && github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + concurrency: + group: release-${{ github.event.pull_request.number }} + cancel-in-progress: false + permissions: + contents: write + actions: write + steps: + - uses: danielroe/uppt/release@3a4fd445ce266b91dd73ced7ae8140cc0f9fc19c + with: + token: ${{ secrets.GITHUB_TOKEN }} + packages: | + packages/* + !packages/playground + + pack: + if: github.event_name == 'workflow_dispatch' && startsWith(github.ref, + 'refs/tags/v') + runs-on: ubuntu-latest + concurrency: + group: pack-${{ github.ref }} + cancel-in-progress: false + permissions: {} + outputs: + files: ${{ steps.pack.outputs.files }} + steps: + - id: pack + uses: danielroe/uppt/pack@3a4fd445ce266b91dd73ced7ae8140cc0f9fc19c + with: + packages: | + packages/* + !packages/playground + + publish: + if: | + github.event_name == 'workflow_dispatch' + && startsWith(github.ref, 'refs/tags/v') + && needs.pack.outputs.files != '[]' + needs: pack + runs-on: ubuntu-latest + concurrency: + group: publish-${{ github.ref }} + cancel-in-progress: false + permissions: + id-token: write + steps: + - uses: danielroe/uppt/publish@3a4fd445ce266b91dd73ced7ae8140cc0f9fc19c + with: + files: ${{ needs.pack.outputs.files }} + environment: npm diff --git a/packages/lib/package.json b/packages/lib/package.json index ad5c50c..70868ee 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -54,7 +54,7 @@ "build": "tsc && vite build", "test": "vitest run", "typecheck": "tsc --noEmit", - "prepack": "node ../../scripts/copy-publish-files.mjs && pnpm build", + "prepack": "pnpm --workspace-root lint packages/lib && pnpm test && node ../../scripts/copy-publish-files.mjs && pnpm build", "prepublishOnly": "pnpm --workspace-root lint packages/lib && pnpm test" }, "peerDependencies": {