Skip to content

Commit 23a2fec

Browse files
authored
Remove GITOPS_TOKEN and use Staffbase/deploy-web-assets
1 parent 5269e43 commit 23a2fec

1 file changed

Lines changed: 39 additions & 46 deletions

File tree

.github/workflows/cd.yaml

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88

99
env:
1010
NODE_VERSION: 16
11+
DEPLOYMENT_KIND: widget
12+
DEPLOYMENT_TARGET: weather
13+
DEPLOYMENT_STATIC_FILES: staffbase.user-profile-client.min.js
14+
DEPLOYMENT_SOURCE: samples/weather-forecast/dist
15+
1116

1217
jobs:
1318
build-and-deploy:
@@ -39,86 +44,74 @@ jobs:
3944
mkdir samples/weather-forecast/icons
4045
cp samples/weather-forecast/resources/weather-forecast.svg samples/weather-forecast/dist/icons
4146
42-
- uses: actions/checkout@v3
43-
with:
44-
persist-credentials: false
45-
repository: Staffbase/S3-deployment-action
46-
ref: 1.0.1
47-
token: ${{ secrets.GITOPS_TOKEN }}
48-
path: .github/gitops
49-
5047
- name: Publish to S3 DE Prod
51-
if: github.event.release.tag_name != null
52-
uses: ./.github/gitops
48+
if: startsWith(github.ref, 'refs/tags/')
49+
uses: Staffbase/deploy-web-assets@0.1.0
5350
with:
54-
source: samples/weather-forecast/dist
55-
destination: widgets/weather
56-
51+
source: ${{ env.DEPLOYMENT_SOURCE }}
52+
target: ${{ env.DEPLOYMENT_TARGET }}
53+
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
5754
# Varnish settings
58-
static_files: |
59-
manifest.json
60-
frontend_host: frontend-cache-main-de1.staffbase.com
55+
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
56+
frontend_cache_host: frontend-cache-main-de1.staffbase.com
6157
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_DE1_PASSWORD }}
6258

6359
# AWS specific settings
6460
aws_bucket: staffbasestatic-prod-de1
6561
aws_region: eu-central-1
66-
aws_access_key: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_ID }}
67-
aws_secret_key: ${{ secrets.PROD_DE1_AWS_ACCESS_KEY_SECRET }}
62+
aws_access_key_id: ${{ secrets.PROD_DE1_aws_access_key_id_ID }}
63+
aws_access_key_secret: ${{ secrets.PROD_DE1_aws_access_key_id_SECRET }}
6864

6965
- name: Deploy to S3 US Prod
70-
if: github.event.release.tag_name != null
71-
uses: ./.github/gitops
66+
if: startsWith(github.ref, 'refs/tags/')
67+
uses: Staffbase/deploy-web-assets@0.1.0
7268
with:
73-
source: samples/weather-forecast/dist
74-
destination: widgets/weather
75-
69+
source: ${{ env.DEPLOYMENT_SOURCE }}
70+
target: ${{ env.DEPLOYMENT_TARGET }}
71+
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
7672
# Varnish settings
77-
static_files: |
78-
manifest.json
79-
frontend_host: frontend-cache-us1.staffbase.com
73+
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
74+
frontend_cache_host: frontend-cache-us1.staffbase.com
8075
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_PROD_US1_PASSWORD }}
8176

8277
# AWS specific settings
8378
aws_bucket: staffbasestatic-prod-us1
8479
aws_region: us-east-1
85-
aws_access_key: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_ID }}
86-
aws_secret_key: ${{ secrets.PROD_US1_AWS_ACCESS_KEY_SECRET }}
80+
aws_access_key_id: ${{ secrets.PROD_US1_aws_access_key_id_ID }}
81+
aws_access_key_secret: ${{ secrets.PROD_US1_aws_access_key_id_SECRET }}
8782

8883
- name: Publish to S3 DE stage
8984
if: github.ref == 'refs/heads/main'
90-
uses: ./.github/gitops
85+
uses: Staffbase/deploy-web-assets@0.1.0
9186
with:
92-
source: samples/weather-forecast/dist
93-
destination: widgets/weather
94-
87+
source: ${{ env.DEPLOYMENT_SOURCE }}
88+
target: ${{ env.DEPLOYMENT_TARGET }}
89+
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
9590
# Varnish settings
96-
static_files: |
97-
manifest.json
98-
frontend_host: frontend-cache-de1.staffbase.rocks
91+
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
92+
frontend_cache_host: frontend-cache-de1.staffbase.rocks
9993
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_STAGE_DE1_PASSWORD }}
10094

10195
# AWS specific settings
10296
aws_bucket: staffbasestatic-stage-de1
10397
aws_region: eu-central-1
104-
aws_access_key: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_ID }}
105-
aws_secret_key: ${{ secrets.STAGE_DE1_AWS_ACCESS_KEY_SECRET }}
98+
aws_access_key_id: ${{ secrets.STAGE_DE1_aws_access_key_id_ID }}
99+
aws_access_key_secret: ${{ secrets.STAGE_DE1_aws_access_key_id_SECRET }}
106100

107101
- name: Publish to S3 DE dev
108102
if: github.ref == 'refs/heads/dev'
109-
uses: ./.github/gitops
103+
uses: Staffbase/deploy-web-assets@0.1.0
110104
with:
111-
source: samples/weather-forecast/dist
112-
destination: widgets/weather
113-
105+
source: ${{ env.DEPLOYMENT_SOURCE }}
106+
target: ${{ env.DEPLOYMENT_TARGET }}
107+
deployment_kind: ${{ env.DEPLOYMENT_KIND }}
114108
# Varnish settings
115-
static_files: |
116-
manifest.json
117-
frontend_host: frontend-cache-de1.staffbase.dev
109+
static_files: ${{ env.DEPLOYMENT_STATIC_FILES }}
110+
frontend_cache_host: frontend-cache-de1.staffbase.dev
118111
frontend_cache_password: ${{ secrets.FRONTEND_CACHE_DEV_DE1_PASSWORD }}
119112

120113
# AWS specific settings
121114
aws_bucket: staffbasestatic-dev-de1
122115
aws_region: eu-central-1
123-
aws_access_key: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_ID }}
124-
aws_secret_key: ${{ secrets.DEV_DE1_AWS_ACCESS_KEY_SECRET }}
116+
aws_access_key_id: ${{ secrets.DEV_DE1_aws_access_key_id_ID }}
117+
aws_access_key_secret: ${{ secrets.DEV_DE1_aws_access_key_id_SECRET }}

0 commit comments

Comments
 (0)