-
Notifications
You must be signed in to change notification settings - Fork 3
139 lines (112 loc) · 3.86 KB
/
frontend.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: CI/CD frontend
on:
push:
paths:
- 'frontend/**'
- '!backend/**'
- '.github/workflows/frontend.yml'
pull_request:
paths:
- 'frontend/**'
- '.github/workflows/frontend.yml'
- '!backend/**'
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: noi-techpark/github-actions/checkout@v2
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
- name: Test frontend
uses: actions/setup-node@v2
with:
node-version: '14.x'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- run: |
yarn install
yarn run test --passWithNoTests
working-directory: frontend
deploy-test-frontend:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
needs: test
concurrency: deploy-test-frontend
env:
AWS_S3_BUCKET_NAME : 'webcompstore-test'
AWS_REGION : "eu-west-1"
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_API_BASE_URL: "https://api.webcomponents.opendatahub.testingmachine.eu"
X_CDN_URL: "https://cdn.webcomponents.opendatahub.testingmachine.eu"
X_HCAPTCHA_PUBLIC_KEY: 9f9020fc-605d-4f9a-b4d6-a80091e5abc8
X_BUILD_ENVIRONMENT: testing
with:
working-directory: frontend
- name: Setup node and yarn
uses: actions/setup-node@v2
with:
node-version: '14.x'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Build
run: |
yarn install
yarn run build
working-directory: frontend
- name: Sync to S3 bucket
uses: noi-techpark/github-actions/aws-s3-bucket-sync@v2
with:
access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
region: ${{ env.AWS_REGION }}
s3-bucket-name: ${{ env.AWS_S3_BUCKET_NAME }}
folder: ./frontend/dist
deploy-production-frontend:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/prod'
needs: test
concurrency: deploy-production-frontend
env:
AWS_S3_BUCKET_NAME : 'webcompstore-prod'
AWS_REGION : "eu-west-1"
SCRIPTS_HOST: 'https://scripts.opendatahub.com'
steps:
- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2
- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_API_BASE_URL: "https://api.webcomponents.opendatahub.com"
X_CDN_URL: "https://cdn.webcomponents.opendatahub.com"
X_HCAPTCHA_PUBLIC_KEY: 9f9020fc-605d-4f9a-b4d6-a80091e5abc8
X_BUILD_ENVIRONMENT: production
with:
working-directory: frontend
- name: Setup node and yarn
uses: actions/setup-node@v2
with:
node-version: '14.x'
cache: 'yarn'
cache-dependency-path: frontend/yarn.lock
- name: Change scripts host to prod
run: sed -i -e "s%https://scripts.opendatahub.testingmachine.eu%${{env.SCRIPTS_HOST}}%g" frontend/nuxt.config.js
- name: Build
run: |
yarn install
yarn run build
working-directory: frontend
- name: Sync to S3 bucket
uses: noi-techpark/github-actions/aws-s3-bucket-sync@v2
with:
access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }}
region: ${{ env.AWS_REGION }}
s3-bucket-name: ${{ env.AWS_S3_BUCKET_NAME }}
folder: ./frontend/dist