Skip to content

chore: update packages #6

chore: update packages

chore: update packages #6

Workflow file for this run

name: deploy - nextjs
on:
push:
branches:
- main
- testnet
- beta
jobs:
nextjs:
runs-on: ubuntu-latest
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Extract branch name
shell: bash
id: extract_branch
run: |
branch=$(echo ${GITHUB_REF#refs/heads/})
echo "branch=$branch" >> $GITHUB_OUTPUT
- name: save env variable
id: saveEnv
run: echo "NEXT_PUBLIC_GIT_REF=${{ steps.extract_branch.outputs.branch }}" > .env
- run: cat .env
- name: get isProd
id: isProd
uses: notiz-dev/github-action-json-property@release
with:
path: "./deploy.json"
prop_path: "${{ steps.extract_branch.outputs.branch }}.isProd"
- name: get alias
id: alias
uses: notiz-dev/github-action-json-property@release
with:
path: "./deploy.json"
prop_path: "${{ steps.extract_branch.outputs.branch }}.alias"
- name: "Validate Vercel token"
run: |
if [ -z "$VERCEL_TOKEN" ]; then
echo "VERCEL_TOKEN is not set. Please add it as a GitHub secret."
exit 1
fi
- name: "Install vercel"
run: npm i -g vercel
- name: "Deploy to vercel"
id: deploy
run: |
prodRun=""
if [[ ${{steps.isProd.outputs.prop}} == "true" ]]; then
prodRun="--prod"
fi
echo $prodRun
deployment_url=$(vercel --confirm -t $VERCEL_TOKEN --scope $VERCEL_ORG_ID $prodRun)
echo "DEPLOYMENT_URL=$deployment_url" >> $GITHUB_OUTPUT
echo "Deployment URL: $deployment_url"
- name: "Set alias"
run: |
echo ${{steps.alias.outputs.prop}}
vercel alias set ${{ steps.deploy.outputs.DEPLOYMENT_URL }} ${{steps.alias.outputs.prop}} -t $VERCEL_TOKEN --scope $VERCEL_ORG_ID