Migrate @kadena/docs to use Vercel CLI to deploy to preview environments. #18
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: Deploy to Vercel Preview | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_ID }} | |
on: | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
show-progress: false | |
- name: Runner Setup | |
uses: ./.github/actions/runner-setup | |
- name: Detecting App Changes | |
id: detectChanges | |
run: | | |
echo "Detecting Changes" | |
# Enable Error Handling | |
set +e | |
npx turbo-ignore @kadena/docs -f origin/main | |
exit_code=$? | |
#Disable Error Handling | |
set -e | |
echo "exit_code: $exit_code" | |
if [ $exit_code -eq 0 ]; then | |
echo "changed=false" >> $GITHUB_OUTPUT | |
else | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Install Vercel CLI | |
if: steps.detectChanges.outputs.changed == 'blub' | |
run: pnpm add --global vercel@34.2.5 | |
- name: Pull Vercel Environment Information | |
if: steps.detectChanges.outputs.changed == 'blub' | |
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build App for Vercel Deployment | |
if: steps.detectChanges.outputs.changed == 'blub' | |
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --debug | |
- name: Deploy Project Artifacts to Vercel | |
if: steps.detectChanges.outputs.changed == 'blub' | |
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --archive=tgz |