-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (73 loc) · 2.65 KB
/
.xp-archive-deploy.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
name: Build and deploy XP archive
on:
workflow_call:
inputs:
naisEnv:
required: true
type: string
VITE_APP_ORIGIN:
required: true
type: string
XP_ORIGIN:
required: true
type: string
HTML_RENDER_API:
required: true
type: string
secrets:
READER_TOKEN:
required: true
NAIS_WORKLOAD_IDENTITY_PROVIDER:
required: true
jobs:
build-and-deploy:
name: Build and deploy
runs-on: ubuntu-latest
environment: ${{ inputs.naisEnv }}-xp
permissions:
contents: read
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: 'https://npm.pkg.github.com'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci --include-workspace-root --workspace=common --workspace=xp-archive
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Set env vars
working-directory: xp-archive
run: |
cat > .env <<EOF
NODE_ENV=production
APP_PORT=3499
APP_BASEPATH=/xp
VITE_APP_ORIGIN=${{ inputs.VITE_APP_ORIGIN }}
XP_ORIGIN=${{ inputs.XP_ORIGIN }}
HTML_RENDER_API=${{ inputs.HTML_RENDER_API }}
EOF
- name: Build application
run: npm run build
working-directory: xp-archive
- name: Build and push docker image
uses: nais/docker-build-push@v0
id: docker-push
with:
team: personbruker
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
dockerfile: Dockerfile_xp
image_suffix: ${{ inputs.naisEnv }}
- name: Deploy application
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: ${{ inputs.naisEnv }}-gcp
RESOURCE: xp-archive/.nais/config.yml
VAR: image=${{ steps.docker-push.outputs.image }}
VARS: xp-archive/.nais/vars/${{ inputs.naisEnv }}.yml