-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (99 loc) · 4.35 KB
/
cd.yaml
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
112
113
114
115
116
117
name: Deploy to AWS S3
on:
push:
branches: ['main', 'dev']
release:
types: [published]
env:
NODE_VERSION: 20
DEPLOYMENT_KIND: widget
DEPLOYMENT_TARGET: weather
DEPLOYMENT_STATIC_FILES: staffbase.user-profile-client.min.js
DEPLOYMENT_SOURCE: samples/weather-forecast/dist
jobs:
build-and-deploy:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node JS
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: samples/weather-forecast/yarn.lock
registry-url: 'https://npm.pkg.github.com/'
scope: '@staffbase'
- run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.STAFFBOT_NPM_READ }}" >> samples/weather-forecast/.npmrc
- name: Yarn install
run: yarn install --cwd samples/weather-forecast --frozen-lockfile
- name: Build widget
run: yarn --cwd samples/weather-forecast build
- name: Prepare Deployment
run: |
mkdir samples/weather-forecast/icons
cp samples/weather-forecast/resources/weather-forecast.svg samples/weather-forecast/dist/icons
- name: Publish to S3 DE Prod
if: startsWith(github.ref, 'refs/tags/')
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
target: ${{ env.DEPLOYMENT_TARGET }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-main-de1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_DE1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-prod-de1
aws_region: eu-central-1
aws_access_key_id: ${{ secrets.PROD_DE1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.PROD_DE1_aws_access_key_id_SECRET }}
- name: Deploy to S3 US Prod
if: startsWith(github.ref, 'refs/tags/')
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
target: ${{ env.DEPLOYMENT_TARGET }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-us1.staffbase.com
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_US1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-prod-us1
aws_region: us-east-1
aws_access_key_id: ${{ secrets.PROD_US1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.PROD_US1_aws_access_key_id_SECRET }}
- name: Publish to S3 DE stage
if: github.ref == 'refs/heads/main'
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
target: ${{ env.DEPLOYMENT_TARGET }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-de1.staffbase.rocks
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_STAGE_DE1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-stage-de1
aws_region: eu-central-1
aws_access_key_id: ${{ secrets.STAGE_DE1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.STAGE_DE1_aws_access_key_id_SECRET }}
- name: Publish to S3 DE dev
if: github.ref == 'refs/heads/dev'
uses: Staffbase/[email protected]
with:
source: ${{ env.DEPLOYMENT_SOURCE }}
target: ${{ env.DEPLOYMENT_TARGET }}
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
# Varnish settings
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
frontend_cache_host: frontend-cache-de1.staffbase.dev
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_DEV_DE1_PASSWORD }}
# AWS specific settings
aws_bucket: staffbasestatic-dev-de1
aws_region: eu-central-1
aws_access_key_id: ${{ secrets.DEV_DE1_aws_access_key_id_ID }}
aws_access_key_secret: ${{ secrets.DEV_DE1_aws_access_key_id_SECRET }}