From 0a04f24a845cbfc6c4e8a43cbef6221f66f493ec Mon Sep 17 00:00:00 2001 From: Sam Laycock Date: Fri, 29 Dec 2023 11:07:29 +0000 Subject: [PATCH] build: add publish and storybook Github actions --- .github/workflows/publish.yaml | 39 ++++++++++++++++++++++++++++++++ .github/workflows/storybook.yaml | 36 +++++++++++++++++++++++++++++ package.json | 1 + packages/react/package.json | 12 ++++------ packages/tailwind/package.json | 12 ++++------ tsconfig.base.json | 3 ++- 6 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/publish.yaml create mode 100644 .github/workflows/storybook.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..d7a70c6 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,39 @@ +name: Publish + +run-name: Publishing new version (via ${{ github.actor }}) 🚀 + +on: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "This job was triggered by ${{ github.actor }} on ${{ github.ref }}." + - name: Check out repository code + uses: actions/checkout@v2 + - name: Setup PNPM + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node.js 18.x + uses: actions/setup-node@v2 + with: + node-version: 18.x + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Create PR or publish + uses: changesets/action@v1 + with: + publish: pnpm publish --access public + commit: "chore: publish" + title: Publish new version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/storybook.yaml b/.github/workflows/storybook.yaml new file mode 100644 index 0000000..987ab12 --- /dev/null +++ b/.github/workflows/storybook.yaml @@ -0,0 +1,36 @@ +name: Storybook + +run-name: Publishing new Storybook build (via ${{ github.actor }}) 📖 + +on: + push: + branches: + - main + workflow_dispatch: + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "This job was triggered by ${{ github.actor }} on ${{ github.ref }}." + - name: Check out repository code + uses: actions/checkout@v2 + - name: Setup PNPM + uses: pnpm/action-setup@v2 + with: + version: 8 + - name: Setup Node.js 18.x + uses: actions/setup-node@v2 + with: + node-version: 18.x + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Publish Storybook + uses: cloudflare/wrangler-action@v3 + with: + workingDirectory: "www/storybook" + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} diff --git a/package.json b/package.json index 77726a8..fd6e808 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "ui", "private": true, "scripts": { + "publish": "pnpm publish -r", "postinstall": "npx husky install" }, "keywords": [], diff --git a/packages/react/package.json b/packages/react/package.json index bff01c6..61e8e15 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,9 +1,6 @@ { "name": "@cloudmix-dev/react", "version": "0.0.10", - "files": [ - "dist" - ], "main": "./dist/index.cjs.js", "module": "./dist/index.es.mjs", "types": "./dist/index.d.ts", @@ -19,11 +16,12 @@ } } }, + "files": ["dist"], + "sideEffects": false, "scripts": { - "dev": "vite", - "build": "tsc && vite build", - "preview": "vite preview", - "prepare": "npm run build" + "build": "vite build", + "prepare": "npm run build", + "tsc": "tsc" }, "dependencies": { "@heroicons/react": "~2.1.1", diff --git a/packages/tailwind/package.json b/packages/tailwind/package.json index f054ed0..3fb94f4 100644 --- a/packages/tailwind/package.json +++ b/packages/tailwind/package.json @@ -1,9 +1,6 @@ { "name": "@cloudmix-dev/tailwind", "version": "0.0.10", - "files": [ - "dist" - ], "main": "./dist/index.cjs.js", "module": "./dist/index.es.mjs", "types": "./dist/index.d.ts", @@ -19,11 +16,12 @@ } } }, + "files": ["dist"], + "sideEffects": false, "scripts": { - "dev": "vite", - "build": "tsc && vite build", - "preview": "vite preview", - "prepare": "npm run build" + "build": "vite build", + "prepare": "npm run build", + "tsc": "tsc" }, "dependencies": { "@tailwindcss/container-queries": "~0.1.1", diff --git a/tsconfig.base.json b/tsconfig.base.json index aa3543f..35b1a3e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -20,6 +20,7 @@ "isolatedModules": true, "incremental": true, "noUncheckedIndexedAccess": true, - "baseUrl": "." + "baseUrl": ".", + "noEmit": true } }