-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (161 loc) · 6.36 KB
/
build.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Node.js CI
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
name: Build Next.JS Webapp
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- name: Use Node.js 21
uses: actions/setup-node@v4
with:
node-version: 21
cache: "pnpm"
- run: pnpm i --frozen-lockfile
- run: pnpm lint
- run: pnpm build
env:
SENTRY_ENVIRONMENT: ${{ github.ref_name == 'main' && 'production' || 'staging' }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_RELEASE: ${{ github.sha }}
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
NEXT_PUBLIC_EAB_HOST: 'https://eab.api.hm.edu'
NEXT_PUBLIC_ACME_HOST: 'https://acme.hm.edu'
NEXT_PUBLIC_PKI_HOST: 'https://pki.api.hm.edu'
NEXT_PUBLIC_DOMAIN_HOST: 'https://domain.api.hm.edu'
NEXT_PUBLIC_AUTH_IDP: 'https://sso.hm.edu'
NEXT_PUBLIC_ORGANIZATION_NAME: 'Hochschule München'
NEXT_PUBLIC_DOCS_URL: 'https://collab.dvb.bayern/pages/viewpage.action?pageId=441753602'
e2e:
runs-on: ubuntu-24.04
name: Run E2E Cypress tests
container:
image: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- run: pnpm i --frozen-lockfile
- name: Cypress run
id: cypress
uses: cypress-io/github-action@v6
with:
build: pnpm build
start: pnpm start
record: true
env:
# pass the Cypress Cloud record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# pass the project ID from the secrets through environment variable
CYPRESS_PROJECT_ID: ${{ secrets.PROJECT_ID }}
NEXT_PUBLIC_DISABLE_CSP: true
NEXT_PUBLIC_EAB_HOST: 'https://eab.api.hm.edu'
NEXT_PUBLIC_ACME_HOST: 'https://acme.hm.edu'
NEXT_PUBLIC_PKI_HOST: 'https://pki.api.hm.edu'
NEXT_PUBLIC_DOMAIN_HOST: 'https://domain.api.hm.edu'
NEXT_PUBLIC_AUTH_IDP: 'https://sso.hm.edu'
NEXT_PUBLIC_ORGANIZATION_NAME: 'Hochschule München'
NEXT_PUBLIC_DOCS_URL: 'https://collab.dvb.bayern/pages/viewpage.action?pageId=441753602'
HOST: "0.0.0.0"
NEXT_PUBLIC_CI: "true"
continue-on-error: true
- uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: cypress/videos
- name: Check on failures
if: steps.cypress.outcome == 'failure'
run: exit 1
docker:
strategy:
matrix:
university:
- name: Hochschule München
eab_host: https://eab.api.hm.edu
acme_host: https://acme.hm.edu
pki_host: https://pki.api.hm.edu
domain_host: https://domain.api.hm.edu
auth_idp: https://sso.hm.edu
logo: resources/hm-edu/logo.png
logo-small: resources/hm-edu/logo-small.png
favicon: resources/hm-edu/favicon.ico
image_name: hm-edu/portal-frontend
- name: Hochschule Hof
eab_host: https://eab.pki.hof-university.de
acme_host: https://acme.pki.hof-university.de
pki_host: https://rest.pki.hof-university.de
domain_host: https://domains.pki.hof-university.de
auth_idp: https://sso.hof-university.de
logo: resources/hs-hof/logo.png
logo-small: resources/hs-hof/logo-small.png
favicon: resources/hs-hof/favicon.ico
image_name: hm-edu/portal-frontend-hof
runs-on: ubuntu-latest
name: Docker Image for ${{ matrix.university.name }}
needs: e2e
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ matrix.university.image_name }}
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value={{branch}}-{{sha}}-{{date 'X'}},enable=${{ github.event_name != 'pull_request' }}
- name: Replace images
run: |
cp ${{ matrix.university.logo }} public/logo.png
cp ${{ matrix.university.logo-small }} public/logo-small.png
cp ${{ matrix.university.favicon }} public/favicon.ico
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secrets: |
SENTRY_ENVIRONMENT=${{ github.ref_name == 'main' && 'production' || 'staging' }}
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_RELEASE=${{ github.sha }}
NEXT_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN }}
NEXT_PUBLIC_EAB_HOST=${{ matrix.university.eab_host }}
NEXT_PUBLIC_ACME_HOST=${{ matrix.university.acme_host }}
NEXT_PUBLIC_PKI_HOST=${{ matrix.university.pki_host }}
NEXT_PUBLIC_DOMAIN_HOST=${{ matrix.university.domain_host }}
NEXT_PUBLIC_AUTH_IDP=${{ matrix.university.auth_idp }}
NEXT_PUBLIC_ORGANIZATION_NAME=${{ matrix.university.name }}
NEXT_PUBLIC_DOCS_URL=https://collab.dvb.bayern/pages/viewpage.action?pageId=441753602