-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (102 loc) · 2.85 KB
/
upload-paywall.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
103
104
105
106
107
108
109
110
111
name: Deploy paywall
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
jobs:
build-staging:
name: Build Staging
if: github.ref == 'refs/heads/dev'
runs-on: ubuntu-latest
environment:
name: staging
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Install
run: pnpm install --no-frozen-lockfile
- name: Build
run: pnpm build:paywall:ci
env:
DOTENV_KEY: ${{ secrets.DOTENV_KEY }}
- name: Archive staging artifacts
uses: actions/upload-artifact@v3
with:
name: dist-staging
path: apps/paywall/dist
build-prod:
name: Build Prod
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: production
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Install
run: pnpm install --no-frozen-lockfile
- name: Build
run: pnpm build:paywall:ci
env:
DOTENV_KEY: ${{ secrets.DOTENV_KEY }}
- name: Archive prod artifacts
uses: actions/upload-artifact@v3
with:
name: dist-prod
path: apps/paywall/dist
deploy-staging:
name: Deploy to Staging (S3)
if: github.ref == 'refs/heads/dev'
needs: [build-staging]
runs-on: ubuntu-latest
environment:
name: staging
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: dist-staging
- run: ls -la
- uses: BetaHuhn/do-spaces-action@v2
with:
access_key: ${{ secrets.DIGITAL_OCEAN_ACCESS_KEY}}
space_region: ${{ secrets.DIGITAL_OCEAN_SPACE_REGION }}
secret_key: ${{ secrets.DIGITAL_OCEAN_SECRET_KEY }}
space_name: ${{ secrets.DIGITAL_OCEAN_PAYWALL_SPACE_NAME }}
source: index.js
out_dir: app
deploy-prod:
name: Deploy to Prod (S3)
if: github.ref == 'refs/heads/main'
needs: [build-prod]
runs-on: ubuntu-latest
environment:
name: production
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: dist-prod
- run: ls -la
- uses: BetaHuhn/do-spaces-action@v2
with:
access_key: ${{ secrets.DIGITAL_OCEAN_ACCESS_KEY}}
space_region: ${{ secrets.DIGITAL_OCEAN_SPACE_REGION }}
secret_key: ${{ secrets.DIGITAL_OCEAN_SECRET_KEY }}
space_name: ${{ secrets.DIGITAL_OCEAN_PAYWALL_SPACE_NAME }}
source: index.js
out_dir: app