From 99fe7bf239217994afa796226759eeda98e0e22e Mon Sep 17 00:00:00 2001 From: David Hunt Date: Tue, 8 Oct 2024 22:18:03 +1300 Subject: [PATCH] added changeset release workflow with github actions --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ package.json | 4 +-- packages/svelte/package.json | 2 +- 3 files changed, 51 insertions(+), 3 deletions(-) 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..77c6ec6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + release: + permissions: + contents: write + pull-requests: write + issues: write + timeout-minutes: 20 + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.x' + + - name: Install Dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm build + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + publish: pnpm changeset:release + version: pnpm changeset:version + commit: "chore: new release" + title: "chore: new release candidate" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index d450ec0..5f4bac3 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "changeset": "changeset", - "publish": "changeset publish", - "version": "changeset version", + "changeset:release": "changeset publish", + "changeset:version": "changeset version", "build": "pnpm -r build", "test:watch": "vitest", "test": "vitest --run" diff --git a/packages/svelte/package.json b/packages/svelte/package.json index dbee469..aa42518 100644 --- a/packages/svelte/package.json +++ b/packages/svelte/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "dev": "vite dev", - "build": "vite build && npm run package", + "build:package": "vite build && npm run package", "preview": "vite preview", "package": "svelte-kit sync && svelte-package && publint", "prepublishOnly": "npm run package",