mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-11 09:51:40 +00:00
chore(release): version packages (#114)
This commit is contained in:
committed by
GitHub
parent
9a8cb016a8
commit
fa3af5d020
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"@shadcn/ui": patch
|
||||
---
|
||||
|
||||
Initial commit.
|
||||
8
.github/version-pr/action.yml
vendored
8
.github/version-pr/action.yml
vendored
@@ -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"
|
||||
19
.github/version-pr/index.js
vendored
19
.github/version-pr/index.js
vendored
@@ -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)
|
||||
}
|
||||
2
.github/version-script-beta.js
vendored
2
.github/version-script-beta.js
vendored
@@ -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) => {
|
||||
|
||||
2
.github/version-script-next.js
vendored
2
.github/version-script-next.js
vendored
@@ -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) => {
|
||||
|
||||
6
.github/workflows/prerelease.yml
vendored
6
.github/workflows/prerelease.yml
vendored
@@ -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
|
||||
|
||||
44
.github/workflows/release-pr.yml
vendored
44
.github/workflows/release-pr.yml
vendored
@@ -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 }}
|
||||
@@ -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": {
|
||||
|
||||
7
packages/cli/CHANGELOG.md
Normal file
7
packages/cli/CHANGELOG.md
Normal file
@@ -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.
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user