-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add "Deploy Preview" GitHub workflow #2079
chore: Add "Deploy Preview" GitHub workflow #2079
Conversation
chore(repo): Add install site in isolation script chore(repo): Globally install secco chore(repo): Begin preview workflow chore(repo): Use actions/core chore(backend): Use cpy instead of rsync chore(repo): Update nextjs playground chore(repo): Add missing dep to nextjs playground chore(repo): Update lock file
🦋 Changeset detectedLatest commit: 60bc99f The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
jobs: | ||
preview: | ||
if: ${{ startsWith(github.event.comment.body, '!preview') && github.repository == 'clerk/javascript' && github.event.issue.pull_request }} | ||
runs-on: ${{ vars.RUNNER_NORMAL }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's not urgent so no need to spend more money than necessary
VERCEL_ORG_ID: ${{ secrets.VERCEL_CLERK_PROD_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_JS_PREVIEW_PROJECT_ID }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Env vars that the Vercel API uses (kind of undocumented feature at this point)
echo "DATE=$(date -u +"%b %d, %Y %I:%M %p")" >> $GITHUB_ENV | ||
|
||
- name: Install site in isolation | ||
run: node scripts/install-site-in-isolation.mjs playground/nextjs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future we could easily swap this to another site
@@ -35,7 +35,7 @@ | |||
"publish:local": "npx yalc push --replace --sig", | |||
"build:lib": "tsup --env.NODE_ENV production", | |||
"build:tests": "tsc -p tsconfig.test.json", | |||
"build:runtime": "rsync -r --include '*/' --include '*.js' --include '*.mjs' --exclude='*' src/runtime dist", | |||
"build:runtime": "cpy 'src/runtime/**/*.{mjs,js,cjs}' dist/runtime", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using https://github.com/nektos/act to test this workflow locally and rsync
isn't installed in every linux distro. So I switched to a package that'll work everywhere (and is easier to grok)
}, | ||
"dependencies": { | ||
"@clerk/backend": "latest", | ||
"@clerk/clerk-react": "latest", | ||
"@clerk/clerk-sdk-node": "latest", | ||
"@clerk/nextjs": "latest", | ||
"@clerk/shared": "latest", | ||
"@clerk/themes": "latest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clerk/themes
is used but not actually installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 Looks great! No blocking comments. This will be a nice workflow improvement.
Should we add info on this to the contributing doc as well? Or do you want to stick to the internal notion page?
|
||
// Installing secco | ||
await core.group('Installing secco (if not already installed)', async () => { | ||
await $`command -v secco || (command -v sudo && sudo npm install -g secco@latest) || npm install -g secco@latest`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ why the need for sudo
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you run this locally (which it is designed for, you can fully run this locally) this is sometimes necessary in some environments. Ideally you already have it installed globally anyways then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(passing thought) This feels like the beginning of a util that could be used locally to create playgrounds from our integration templates. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you can already use it locally start to finish 👍
- name: Copy clerk-js/dist into public/clerk-js of test site | ||
run: | | ||
cp -r $GITHUB_WORKSPACE/packages/clerk-js/dist $FULL_TMP_FOLDER/public/clerk-js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thinking 👍
Co-authored-by: Bryce Kalow <bryce@clerk.dev>
I can do that in another PR, I saw some needed unrelated changes there |
Description
This PR adds a new GitHub workflow called
preview
. You'll be able to comment!preview
on a PR to buildplayground/nextjs
with the current state of your PR. This also includesclerk-js
.How it works:
Note: Only members of Clerk Vercel Team will be able to access the deploy preview
Parts of the logic are copied from https://github.com/clerk/clerk-docs/blob/main/.github/workflows/preview.yml
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/clerk-expo
@clerk/fastify
gatsby-plugin-clerk
@clerk/localizations
@clerk/nextjs
@clerk/clerk-react
@clerk/remix
@clerk/clerk-sdk-node
@clerk/shared
@clerk/themes
@clerk/types
build/tooling/chore