mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-01-12 16:53:19 +08:00
ci: build vercel manually (#1784)
This commit is contained in:
68
.github/workflows/vercel.yml
vendored
Normal file
68
.github/workflows/vercel.yml
vendored
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
name: Vercel
|
||||||
|
|
||||||
|
env:
|
||||||
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||||
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- beta
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
vercel:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
environment:
|
||||||
|
name: ${{ github.ref_name == 'master' && 'Production' || 'Preview' }}
|
||||||
|
url: ${{ github.ref_name == 'master' && 'https://stacks-blockchain-api.vercel.app/' || 'https://stacks-blockchain-api-pbcblockstack-blockstack.vercel.app/' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
|
||||||
|
- name: Cache node modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
env:
|
||||||
|
cache-name: cache-node-modules
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.npm
|
||||||
|
**/node_modules
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||||
|
${{ runner.os }}-build-
|
||||||
|
${{ runner.os }}-
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
run: npm ci --audit=false
|
||||||
|
|
||||||
|
- name: Install Vercel CLI
|
||||||
|
run: npm install --global vercel@latest
|
||||||
|
|
||||||
|
- name: Pull Vercel environment information
|
||||||
|
run: vercel pull --yes --environment=${{ github.ref_name == 'master' && 'production' || 'preview' }} --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build project artifacts
|
||||||
|
run: vercel build ${{ github.ref_name == 'master' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }}
|
||||||
|
|
||||||
|
- name: Deploy project artifacts to Vercel
|
||||||
|
id: deploy
|
||||||
|
run: vercel ${{ github.ref_name == 'master' && '--prod' || 'deploy' }} --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | awk '{print "deployment_url="$1}' >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Add comment with Vercel deployment URL
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
uses: thollander/actions-comment-pull-request@v2
|
||||||
|
with:
|
||||||
|
comment_tag: vercel
|
||||||
|
message: |
|
||||||
|
Vercel deployment URL: ${{ steps.deploy.outputs.deployment_url }} :rocket:
|
||||||
5
vercel.json
Normal file
5
vercel.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"git": {
|
||||||
|
"deploymentEnabled": false
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user