Skip to content

Commit

Permalink
build(deploy): add deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusbolik committed Jul 5, 2023
1 parent f6586e1 commit b7d6c4d
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
Binary file removed .github/screenshot.png
Binary file not shown.
47 changes: 47 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy Preview
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches-ignore:
- main
paths-ignore:
- '*.yml'
- '*.yaml'
- './demo/*'

# Cancel previous running jobs (save build minutes)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
Deploy-Preview:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3

# Setup node and yarn with cache
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install Vercel CLI
run: npm i -g vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
# Sources:
# - https://vercel.com/guides/how-can-i-use-github-actions-with-vercel
# - https://aaronfrancis.com/2021/the-perfect-vercel-github-actions-deployment-pipeline
47 changes: 47 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy Prod
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches:
- main
paths-ignore:
- '*.yml'
- '*.yaml'
- './demo/*'

# Cancel previous running jobs (save build minutes)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref == 'refs/heads/main' }}

jobs:
Deploy-Preview:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3

# Setup node and yarn with cache
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"

- name: Install Vercel CLI
run: npm i -g vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
# Sources:
# - https://vercel.com/guides/how-can-i-use-github-actions-with-vercel
# - https://aaronfrancis.com/2021/the-perfect-vercel-github-actions-deployment-pipeline

0 comments on commit b7d6c4d

Please sign in to comment.