-
-
Notifications
You must be signed in to change notification settings - Fork 641
102 lines (88 loc) · 3.2 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Deploy Prod
on:
workflow_dispatch:
inputs:
patch:
description: 'Should this be a patch release?'
type: boolean
required: true
default: true
schedule:
# Deploy at 5pm Sunday PST, which is 1am Monday UTC
# * is a special character in YAML so you have to quote this string
- cron: '0 1 * * 1'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2 # So sentry can get the previous commit
# Use the dim-release-bot token rather than the default
token: ${{ secrets.GH_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
- name: Install SSH key
uses: benoitchantre/[email protected]
with:
private-key: ${{ secrets.SSH_KEY }}
private-key-name: dim.rsa
known-hosts: ${{ secrets.REMOTE_HOST }}
- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
- name: set feature
if: ${{ !github.event.inputs.patch }}
run: |
echo "build_level=feature" >> $GITHUB_ENV
- name: set bug
if: ${{ github.event.inputs.patch }}
run: |
echo "build_level=bug" >> $GITHUB_ENV
- name: Bump release version
id: bump_version
uses: christian-draeger/[email protected]
with:
current-version: ${{ steps.package-version.outputs.current-version }}
version-fragment: ${{ env.build_level }}
- name: set version
run: |
echo "VERSION=${{ steps.bump_version.outputs.next-version }}" >> $GITHUB_ENV
- name: Update Version in package.json
uses: dmikey/package-json-version@master
with:
version: ${{ env.VERSION }}
- name: Install
run: yarn install --frozen-lockfile --prefer-offline
- name: Build and deploy
run: ./build/deploy-prod.sh
env:
NODE_OPTIONS: "--max_old_space_size=8192"
WEB_API_KEY: ${{ secrets.PROD_API_KEY }}
WEB_OAUTH_CLIENT_ID: ${{ secrets.PROD_OAUTH_CLIENT_ID }}
WEB_OAUTH_CLIENT_SECRET: ${{ secrets.PROD_OAUTH_CLIENT_SECRET }}
DIM_API_KEY: ${{ secrets.PROD_DIM_API_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_PATH: app.destinyitemmanager.com
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# Use the dim-release-bot token rather than the default
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Purge CloudFlare cache
run: ./build/purge-cloudflare.sh
env:
CLOUDFLARE_KEY: ${{ secrets.CLOUDFLARE_KEY }}
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
APP_DOMAIN: app.destinyitemmanager.com
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: destiny-item-manager
SENTRY_PROJECT: dim
with:
environment: release
version: ${{ env.VERSION }}
ignore_missing: true