-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(repo): Introduce retheme-preview action
- Loading branch information
1 parent
8b4c67a
commit 738f342
Showing
2 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Deploy Retheme Preview | ||
run-name: Deploy Retheme Preview by ${{ github.actor }} | ||
|
||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_CLERK_PROD_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_JS_RETHEME_PROJECT_ID }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
preview: | ||
runs-on: ${{ vars.RUNNER_NORMAL }} | ||
timeout-minutes: ${{ fromJSON(vars.TIMEOUT_MINUTES_NORMAL) }} | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Limit action to Clerk members | ||
uses: actions/github-script@v6 | ||
with: | ||
result-encoding: string | ||
retries: 3 | ||
retry-exempt-status-codes: 400,401 | ||
github-token: ${{ secrets.CLERK_COOKIE_PAT }} | ||
script: | | ||
const isMember = await github.rest.orgs.checkMembershipForUser({ | ||
org: 'clerk', | ||
username: context.actor | ||
}); | ||
if (!isMember) { | ||
core.setFailed(`@${actor} is not a member of the Clerk organization`); | ||
} | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup | ||
id: config | ||
uses: ./.github/actions/init | ||
with: | ||
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} | ||
turbo-team: ${{ vars.TURBO_TEAM }} | ||
turbo-token: ${{ secrets.TURBO_TOKEN }} | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Build packages | ||
run: | | ||
npx turbo build $TURBO_ARGS --filter='!@clerk/clerk-js' --filter='!@clerk/localizations' --filter='!@clerk/types' | ||
CLERK_RETHEME=1 npx turbo build $TURBO_ARGS --filter='@clerk/clerk-js' --filter='@clerk/localizations' --filter='@clerk/types' | ||
- name: Install site in isolation | ||
run: node scripts/install-site-in-isolation.mjs playground/nextjs | ||
|
||
- name: Install Vercel CLI | ||
run: npm install --global vercel@latest | ||
|
||
- name: Pull Vercel environment information | ||
run: | | ||
cd $FULL_TMP_FOLDER | ||
vercel pull --yes --environment=prod --token=${{ secrets.VERCEL_CLERK_COOKIE_TOKEN }} | ||
- 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 | ||
- name: Build with Vercel | ||
run: | | ||
cd $FULL_TMP_FOLDER | ||
vercel build --yes --prod | ||
env: | ||
NEXT_PUBLIC_CLERK_JS: /clerk-js/clerk.browser.js | ||
|
||
- name: Deploy to Vercel (prebuilt) | ||
id: vercel-deploy | ||
run: | | ||
cd $FULL_TMP_FOLDER | ||
vercel deploy --prebuilt --token=${{ secrets.VERCEL_CLERK_COOKIE_TOKEN }} --no-wait --prod > deployment_url.txt | ||
echo "url=$(cat deployment_url.txt)" >> $GITHUB_OUTPUT |
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