Skip to content
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

Use deploy-to-vercel-action instead of vercel cli #1026

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ jobs:
tar -xf iota.tar
tar -xf shimmer.tar
tar -xf next.tar
# Convert to Vercel project and upload
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
# Deploy to Vercel
- name: Deploy to Vercel Action
uses: BetaHuhn/deploy-to-vercel-action@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
PR_LABELS: false
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved
PREBUILT: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not going to work because neither FORCE or PREBUILT are in the latest released version of this action.
And judging by the workflow it looks like it might be an important flag. Just letting you know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks for that. We can just wait for the next release or add the latest changes from the repo.
@jlvandenhout wdyt?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, after the restructure we will have a much less complex build, so we might go back to a more vanilla Vercel workflow anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Will convert this to a DRAFT in the meantime. @VmMad thanks for your help ❤️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're welcome! 😃

# Trigger Algolia crawler
- name: Crawl
run: |
Expand Down
33 changes: 8 additions & 25 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,12 @@ jobs:
tar -xf shimmer.tar
tar -xf next.tar
# Convert to Vercel project and upload
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > vercel_output.txt
# Set the deploy URL as an output
- name: Set deploy url
id: deploy_url
run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT
# Create a comment on the pull request with the deployed URL
- name: Comment on pull request
uses: actions/[email protected]
- name: Deploy to Vercel Action
uses: BetaHuhn/deploy-to-vercel-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const DEPLOY_URL = '${{ steps.deploy_url.outputs.DEPLOY_URL }}'
const COMMIT_SHA = '${{ github.event.pull_request.head.sha }}'
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `This pull request has been deployed to Vercel.\n\n\nLatest commit: ${COMMIT_SHA}\n\n:white_check_mark: Preview: ${DEPLOY_URL}`
})
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
PR_LABELS: false
PREBUILT: true
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved