Skip to content

Instantly share code, notes, and snippets.

@mxkaske
Created January 21, 2022 12:48
Show Gist options
  • Save mxkaske/7c409b2f561a351500dea68518ee42be to your computer and use it in GitHub Desktop.
Save mxkaske/7c409b2f561a351500dea68518ee42be to your computer and use it in GitHub Desktop.
name: CD
# Only trigger, when the ci workflow succeeded
# The `workflow_run` will only trigger a workflow run if the workflow file is on the default branch
# See: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run
on:
push:
branches:
- main
workflow_dispatch:
workflow_run:
workflows: ["CI"]
types:
- completed
jobs:
vercel:
name: Deploy Website
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Checkout setup
uses: actions/setup-node@v1
- name: Deploy to Vercel
run: |
prodRun=""
if [[ ${GITHUB_REF} == "refs/heads/main" ]]; then
prodRun="--prod"
fi
npx vercel --token ${VERCEL_TOKEN} $prodRun
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment