Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Move Vercel deployments to reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
admdly committed Nov 27, 2023
1 parent 8ff6ba6 commit 45926c1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 53 deletions.
38 changes: 11 additions & 27 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Vercel Deploy Preview
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches-ignore:
Expand All @@ -10,28 +8,14 @@ on:
branches:
- main

concurrency:
group: deploy-preview

jobs:
deploy-preview:
name: Build and Deploy Preview
runs-on: ubuntu-latest
environment:
name: Preview
url: ${{ steps.deploy-url.outputs.url }}
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id) || github.event_name == 'push' }}
steps:
- uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global 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 }} > vercel-out.txt
- name: Set Environment URL
id: deploy-url
if: ${{ success() }}
run: echo "url=$(tail -n 1 vercel-out.txt)" >> $GITHUB_OUTPUT
build-deploy-preview:
permissions:
contents: read
uses: FOSSBilling/.workflows/.github/workflows/vercel-build-deploy.yml@main
secrets:
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}
with:
environment: Preview
38 changes: 12 additions & 26 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
name: Vercel Deploy Production
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches:
- main

concurrency:
group: deploy-production

jobs:
deploy-production:
name: Build and Deploy Production
runs-on: ubuntu-latest
environment:
name: Production
url: ${{ steps.deploy-url.outputs.url }}
steps:
- uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --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 }} > vercel-out.txt
- name: Set Environment URL
id: deploy-url
if: ${{ success() }}
run: echo "url=$(tail -n 1 vercel-out.txt)" >> $GITHUB_OUTPUT
build-deploy-production:
permissions:
contents: read
uses: FOSSBilling/.workflows/.github/workflows/vercel-build-deploy.yml@main
secrets:
vercel_org_id: ${{ secrets.VERCEL_ORG_ID }}
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel_token: ${{ secrets.VERCEL_TOKEN }}
with:
environment: Production
prod_deployment: true

0 comments on commit 45926c1

Please sign in to comment.