Skip to content

Under Maintenance

Under Maintenance #1

name: Under Maintenance
on:
workflow_dispatch:
jobs:
under-maintenance-deploy:
environment:
name: Production
url: https://coursetable.com
runs-on: ubuntu-latest
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install Vercel CLI
run: bun install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Pseudo Vercel Build
run: mkdir -p .vercel/output/static && cp under_maintenance/site/maintenance.html .vercel/output/static/index.html
- name: Deploy to Vercel and Alias Deployment
run: |
echo "Deploying to production"
vercel deploy --prod --prebuilt --skip-domain --token=${{ secrets.VERCEL_TOKEN }} >deployment-url.txt
# check the exit code
code=$?
if [ $code -eq 0 ]; then
# Now you can use the deployment url from stdout for the next step of your workflow
deploymentUrl=`cat deployment-url.txt`
vercel alias set $deploymentUrl staging.coursetable.com --token=${{ secrets.VERCEL_TOKEN }} --scope=coursetable
else
# Handle the error
errorMessage=`cat error.txt`
echo "There was an error: $errorMessage"
fi