Skip to content

Vercel Production Deployment #81

Vercel Production Deployment

Vercel Production Deployment #81

name: Vercel Production Deployment
on:
pull_request:
branches:
- main
types: [closed]
workflow_dispatch:
jobs:
deployment:
if: (github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
concurrency: Production
environment:
name: Production
url: ${{ steps.get_release_url.outputs.release_url }}
steps:
- uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install -g vercel
- name: Link Vercel Project
run: vercel link --token=${{secrets.VERCEL_TOKEN}} --project ${{vars.VERCEL_PROJECT}} --yes
- name: Deploy with Vercel
run: vercel deploy --prod -f --token=${{secrets.VERCEL_TOKEN}} >deployment-url.txt 2>error.txt
- name: Set release url
id: get_release_url
run: echo release_url="https://gakuseibot.pkopko.jp" >> $GITHUB_OUTPUT
- name: Faild Log
if: failure()
run: |
if [ -s error.txt ]; then
cat error.txt
exit 1
fi
- name: Show Deployment URL
run: |
deploy_url=$(cat deployment-url.txt) >> $GITHUB_ENV
echo "Deployment URL: $deploy_url"