From fa3af5d0203ae58e5945ccd889fb6cff0cee2de4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Mar 2023 15:06:29 +0400 Subject: [PATCH] chore(release): version packages (#114) --- .changeset/khaki-roses-rule.md | 5 ---- .github/version-pr/action.yml | 8 ------ .github/version-pr/index.js | 19 -------------- .github/version-script-beta.js | 2 +- .github/version-script-next.js | 2 +- .github/workflows/prerelease.yml | 6 ++--- .github/workflows/release-pr.yml | 44 -------------------------------- package.json | 4 +-- packages/cli/CHANGELOG.md | 7 +++++ packages/cli/package.json | 8 +++--- 10 files changed, 18 insertions(+), 87 deletions(-) delete mode 100644 .changeset/khaki-roses-rule.md delete mode 100644 .github/version-pr/action.yml delete mode 100644 .github/version-pr/index.js delete mode 100644 .github/workflows/release-pr.yml create mode 100644 packages/cli/CHANGELOG.md diff --git a/.changeset/khaki-roses-rule.md b/.changeset/khaki-roses-rule.md deleted file mode 100644 index d45b54dd4e..0000000000 --- a/.changeset/khaki-roses-rule.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@shadcn/ui": patch ---- - -Initial commit. diff --git a/.github/version-pr/action.yml b/.github/version-pr/action.yml deleted file mode 100644 index 9e82caeba2..0000000000 --- a/.github/version-pr/action.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: "Determine version" -description: "Determines npm package version based on PR number and commit SHA" -outputs: - version: - description: "npm package version" -runs: - using: "node16" - main: "index.js" diff --git a/.github/version-pr/index.js b/.github/version-pr/index.js deleted file mode 100644 index 3236b6559b..0000000000 --- a/.github/version-pr/index.js +++ /dev/null @@ -1,19 +0,0 @@ -// This is based on the work done by the next-auth team. -const fs = require("fs") -const path = require("path") -const core = require("@actions/core") - -try { - const packageJSONPath = path.join(process.cwd(), "packages/cli/package.json") - const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, "utf8")) - - const sha8 = process.env.GITHUB_SHA.substring(0, 8) - const prNumber = process.env.PR_NUMBER - - const packageVersion = `0.0.0-pr.${prNumber}.${sha8}` - packageJSON.version = packageVersion - core.setOutput("version", packageVersion) - fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON)) -} catch (error) { - core.setFailed(error.message) -} diff --git a/.github/version-script-beta.js b/.github/version-script-beta.js index a1b060bd86..4dd5ea221d 100644 --- a/.github/version-script-beta.js +++ b/.github/version-script-beta.js @@ -4,7 +4,7 @@ import { exec } from "child_process" import fs from "fs" -const pkgJsonPath = "cli/package.json" +const pkgJsonPath = "packages/cli/package.json" try { const pkg = JSON.parse(fs.readFileSync(pkgJsonPath)) exec("git rev-parse --short HEAD", (err, stdout) => { diff --git a/.github/version-script-next.js b/.github/version-script-next.js index 9a1a616957..c18a7af180 100644 --- a/.github/version-script-next.js +++ b/.github/version-script-next.js @@ -4,7 +4,7 @@ import { exec } from "child_process" import fs from "fs" -const pkgJsonPath = "cli/package.json" +const pkgJsonPath = "packages/cli/package.json" try { const pkg = JSON.parse(fs.readFileSync(pkgJsonPath)) exec("git rev-parse --short HEAD", (err, stdout) => { diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 497c1eeb6a..e61cb0046c 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -36,13 +36,13 @@ jobs: - name: Modify package.json version run: node .github/version-script-beta.js - - name: Authenticate to NPM - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > packages/cli/.npmrc + # - name: Authenticate to NPM + # run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > packages/cli/.npmrc - name: Publish Beta to NPM run: pnpm pub:beta env: - NPM_PUBLISH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} - name: get-npm-version id: package-version diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml deleted file mode 100644 index 12acd637f9..0000000000 --- a/.github/workflows/release-pr.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: release-pr -on: - pull_request: - types: [opened, reopened, synchronize, labeled] - -jobs: - next-drupal: - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'shadcn' && contains(github.event.pull_request.labels.*.name, format('release-pr{0} cli', ':')) }} - environment: Preview - steps: - - name: Init - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Install dependencies - run: yarn install - - name: Determine version - uses: ./.github/version-pr - id: determine-version - env: - PR_NUMBER: ${{ github.event.number }} - - name: Publish to npm - run: | - cd packages/cli - echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" >> .npmrc - yarn publish --no-git-checks --access public --tag experimental - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Comment version on PR - uses: NejcZdovc/comment-pr@v2 - with: - message: - "🎉 Experimental release [published 📦️ on npm](https://npmjs.com/package/@shadcn/ui/v/${{ env.VERSION }})!\n \ - ```sh\npnpm @shadcn/ui@${{ env.VERSION }}\n```\n \ - ```sh\nyarn @shadcn/ui@${{ env.VERSION }}\n```\n \ - ```sh\nnpx @shadcn/ui@${{ env.VERSION }}\n```" - env: - VERSION: ${{ steps.determine-version.outputs.version }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index c2c131145b..f2eed72bd5 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,8 @@ "prepare": "husky install", "check": "turbo lint typecheck format:check", "release": "changeset version", - "pub:beta": "cd cli && pnpm pub:beta", - "pub:release": "cd cli && pnpm pub:release" + "pub:beta": "cd packages/cli && pnpm pub:beta", + "pub:release": "cd packages/cli && pnpm pub:release" }, "packageManager": "pnpm@7.13.5", "dependencies": { diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md new file mode 100644 index 0000000000..55fd3c35dd --- /dev/null +++ b/packages/cli/CHANGELOG.md @@ -0,0 +1,7 @@ +# @shadcn/ui + +## 0.0.2 + +### Patch Changes + +- [#112](https://github.com/shadcn/ui/pull/112) [`be701cf`](https://github.com/shadcn/ui/commit/be701cf139e0acc0ced3e161d246f7b2b53dccbe) Thanks [@shadcn](https://github.com/shadcn)! - Initial commit. diff --git a/packages/cli/package.json b/packages/cli/package.json index af10f8f900..e84bad19fa 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@shadcn/ui", - "version": "0.0.1", + "version": "0.0.2", "description": "Add @shadcn/ui components to your app.", "license": "MIT", "author": { @@ -33,9 +33,9 @@ "format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache", "format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache", "release": "changeset version", - "pub:beta": "pnpm build && npm publish --tag beta", - "pub:next": "pnpm build && npm publish --tag next", - "pub:release": "pnpm build && npm publish" + "pub:beta": "pnpm build && npm publish --access public --tag beta", + "pub:next": "pnpm build && npm publish --access public --tag next", + "pub:release": "pnpm build && npm publish --access public" }, "dependencies": { "chalk": "5.2.0",