chore: enforce compatible uploadthing
version for @uploadthing/react
#128
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release - Canary | |
on: | |
pull_request: | |
types: [labeled] | |
branches: | |
- main | |
jobs: | |
release: | |
if: contains(github.event.pull_request.labels.*.name, 'release canary') | |
name: Build & Publish a canary release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use PNPM | |
uses: pnpm/action-setup@v2 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Setup pnpm cache | |
uses: actions/[email protected] | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install deps (with cache) | |
run: pnpm install | |
- name: Check packages for common errors | |
run: pnpm turbo --filter "./packages/*" build | |
- name: Bump version to canary | |
run: node .github/canary-version.js | |
- name: Authenticate to npm and publish | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
for dir in packages/*/; do | |
if [ "$dir" != "packages/config/" ]; then | |
pnpm publish "$dir" --access public --tag canary --no-git-checks | |
fi | |
done | |
- name: Create a new comment notifying of the new canary version | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
// Get package version | |
const fs = require("fs"); | |
let text = 'A new canary is available for testing. You can install this latest build in your project with:\n\n```sh\n' | |
const pkgJsonPaths = fs | |
.readdirSync("packages") | |
.filter((dir) => dir !== "config") | |
.map((dir) => `packages/${dir}/package.json`); | |
for (const pkgJsonPath of pkgJsonPaths) { | |
const packageJson = JSON.parse(fs.readFileSync(pkgJsonPath)); | |
const version = packageJson.version; | |
text += `pnpm add ${packageJson.name}@${version}\n` | |
} | |
text += '```\n\n' | |
// Create a comment on the PR with the new canary version | |
github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.pull_request.number, | |
body: text, | |
}) | |
// Remove the label | |
github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.pull_request.number, | |
name: 'release canary', | |
}); |