feat: add COMPONENTS_BASE_URL for development (#115)

This commit is contained in:
shadcn
2023-03-08 17:50:06 +04:00
committed by GitHub
parent fa3af5d020
commit 92fe54184b
12 changed files with 141 additions and 117 deletions

View File

@@ -28,7 +28,7 @@ jobs:
for (const artifact of allArtifacts.data.artifacts) {
// Extract the PR number and package version from the artifact name
const match = /^npm-package-\@shadcn\/ui@(.*?)-pr-(\d+)/.exec(artifact.name);
const match = /^npm-package-shadcn-ui@(.*?)-pr-(\d+)/.exec(artifact.name);
if (match) {
require("fs").appendFileSync(
@@ -46,7 +46,7 @@ jobs:
with:
number: ${{ env.WORKFLOW_RUN_PR }}
message: |
A new @shadcn/ui prerelease is available for testing. You can install this latest build in your project with:
A new @shadcn/ui prerelease is available for testing. You can use this latest build in your project with:
```sh
pnpm @shadcn/ui@${{ env.BETA_PACKAGE_VERSION }}

View File

@@ -4,16 +4,17 @@ name: Release - Beta
on:
pull_request:
types: [labeled]
# types: [labeled]
branches:
- main
jobs:
prerelease:
if: |
github.repository_owner == 'shadcn' &&
contains(github.event.pull_request.labels.*.name, '🚀 autorelease')
# if: |
# github.repository_owner == 'shadcn' &&
# contains(github.event.pull_request.labels.*.name, '🚀 autorelease')
name: Build & Publish a beta release to NPM
runs-on: ubuntu-latest
environment: Preview
steps:
- name: Checkout Repo
@@ -36,13 +37,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=$NPM_ACCESS_TOKEN" >> packages/cli/.npmrc
env:
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Publish Beta to NPM
run: pnpm pub:beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: get-npm-version
id: package-version
@@ -53,5 +54,5 @@ jobs:
- name: Upload packaged artifact
uses: actions/upload-artifact@v2
with:
name: npm-package-@shadcn\/ui@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
name: npm-package-@shadcn-ui@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name
path: packages/cli/dist/index.js

45
.github/workflows/publish.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
# Adapted from create-t3-app.
name: Publish
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build:
if: ${{ github.repository_owner == 'shadcn' }}
name: Create a PR for release workflow
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use PNPM
uses: pnpm/action-setup@v2.2.4
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install NPM Dependencies
run: pnpm install
- name: Create Version PR or Publish to NPM
id: changesets
uses: changesets/action@v1.4.1
with:
commit: "chore(release): version packages"
title: "chore(release): version packages"
publish: pnpm build:cli
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NODE_ENV: "production"