# Adapted from create-t3-app. name: Release run-name: ${{ github.event_name == 'pull_request' && format('Release Beta - PR {0}', github.event.number) || 'Release Stable' }} on: pull_request: types: [labeled] branches: - main push: branches: - main jobs: prerelease: if: ${{ github.event_name == 'pull_request' && github.repository_owner == 'shadcn-ui' && contains(github.event.pull_request.labels.*.name, '🚀 autorelease') }} name: Publish Beta to NPM runs-on: ubuntu-latest environment: Preview permissions: id-token: write contents: read steps: - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use PNPM uses: pnpm/action-setup@v4 with: version: 10.33.4 - name: Use Node.js 20 uses: actions/setup-node@v4 with: node-version: 20 registry-url: "https://registry.npmjs.org" cache: "pnpm" - name: Update npm for OIDC support run: npm install -g npm@latest - name: Install NPM Dependencies run: pnpm install - name: Modify package.json version run: node .github/version-script-beta.js - name: Publish Beta to NPM run: pnpm pub:beta - name: get-npm-version id: package-version uses: martinbeentjes/npm-get-version-action@main with: path: packages/shadcn - name: Upload packaged artifact uses: actions/upload-artifact@v4 with: name: npm-package-shadcn@${{ steps.package-version.outputs.current-version }}-pr-${{ github.event.number }} # encode the PR number into the artifact name path: packages/shadcn/dist/index.js release: if: ${{ github.event_name == 'push' && github.repository_owner == 'shadcn-ui' }} name: Create Version PR or Publish Stable Release runs-on: ubuntu-latest permissions: id-token: write contents: write pull-requests: write steps: - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - name: Use PNPM uses: pnpm/action-setup@v4 with: version: 10.33.4 - name: Use Node.js 20 uses: actions/setup-node@v4 with: node-version: 20 registry-url: "https://registry.npmjs.org" cache: "pnpm" - name: Update npm for OIDC support run: npm install -g npm@latest - name: Install NPM Dependencies run: pnpm install # - name: Check for errors # run: pnpm check - name: Build the package run: pnpm shadcn:build - name: Import GPG key uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }} git_user_signingkey: true git_commit_gpgsign: true git_tag_gpgsign: true - name: Create Version PR or Publish to NPM id: changesets uses: changesets/action@v1 with: setupGitUser: false commit: "chore(release): version packages" title: "chore(release): version packages" version: node .github/changeset-version.js publish: npx changeset publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_ENV: "production"