-
-
Notifications
You must be signed in to change notification settings - Fork 18
72 lines (68 loc) · 2.31 KB
/
deploy-prod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Build and Deploy Web - PROD
on:
push:
tags:
- v*
env:
DEPLOY_ENV: prod
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN}}
jobs:
build-deploy-web:
name: Deploy Web Prod
environment:
name: prod
url: https://coh3stats.com
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@master
with:
node-version: "20.x"
- name: Cache node modules
uses: actions/cache@v4
env:
cache-name: cache-node-modules-v2
with:
path: |
node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Deps
run: yarn --prefer-offline --frozen-lockfile install
- name: Disable Vercel telemetry
run: yarn next telemetry disable
- name: Create Sentry release
uses: getsentry/action-release@master
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: coh-stats
SENTRY_PROJECT: coh3-stats-web
with:
environment: ${{ env.DEPLOY_ENV }}
ignore_empty: true
ignore_missing: true
- name: Deploy to Vercel hosting
env:
VERCEL_TOKEN: ${{secrets.VERCEL_TOKEN}}
VERCEL_ORG_ID: ${{secrets.VERCEL_ORG_ID}}
VERCEL_PROJECT_ID: ${{secrets.VERCEL_PROJECT_ID}}
run: |
npx vercel telemetry disable
npx vercel pull --yes --environment=production --token=$VERCEL_TOKEN
npx vercel build --prod --token=$VERCEL_TOKEN
npx vercel deploy --prod --prebuilt --token=$VERCEL_TOKEN >deployment-url.txt 2>error.txt
code=$?
if [ $code -eq 0 ]; then
# Now you can use the deployment url from stdout for the next step of your workflow
deploymentUrl=`cat deployment-url.txt`
npx vercel alias $deploymentUrl coh3stats.com --token=$VERCEL_TOKEN --scope cohstats
else
# Handle the error
errorMessage=`cat error.txt`
echo "There was an error: $errorMessage"
fi