[workflow] Update functions.json #43
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: Vercel Preview Deployment | |
env: | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
permissions: | |
contents: read | |
statuses: write | |
pull-requests: write | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
deploy-preview: | |
if: github.actor != 'aoijsbot' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Hash branch name | |
uses: pplanel/[email protected] | |
id: hash_branch | |
with: | |
input: ${{ steps.extract_branch.outputs.branch }} | |
method: MD5 | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
id: cache-npm | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- name: Install dependencies | |
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
run: npm ci --ignore-scripts | |
- name: Pull Vercel Environment Information | |
run: vercel pull --yes --environment=preview --token=$VERCEL_TOKEN | |
- name: Deploy Project Artifacts to Vercel | |
id: vercel | |
env: | |
META_TAG: ${{ steps.hash_branch.outputs.digest }}-${{ github.run_number }}-${{ github.run_attempt}} | |
run: | | |
vercel --version | |
vercel pull --yes --environment=preview --token=$VERCEL_TOKEN | |
vercel build --token=$VERCEL_TOKEN | |
vercel deploy --prebuilt --archive=tgz --token=$VERCEL_TOKEN --meta base_hash=${{ env.META_TAG }} | |
vercel ls --token=$VERCEL_TOKEN --meta base_hash=${{ env.META_TAG }} &> vercel-output | |
url=$(cat vercel-output | grep http | awk '{print $2}') | |
echo "New preview URL: $url" | |
echo "META_TAG=$META_TAG" | |
echo "VERCEL_URL=$url" >> "$GITHUB_OUTPUT" |