Skip to content

Commit 275f3c5

Browse files
committed
Skriver om xp-archive deploy til reusable workflow
1 parent b6b06d4 commit 275f3c5

File tree

2 files changed

+57
-14
lines changed

2 files changed

+57
-14
lines changed

.github/workflows/xp-archive-deploy.yml .github/workflows/.xp-archive-deploy.yml

+34-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
1-
name: Build and deploy XP archive (dev)
1+
name: Build and deploy XP archive
22
on:
3-
workflow_dispatch:
4-
push:
5-
branches:
6-
- master
7-
paths:
8-
- package*.json
9-
- xp-archive/**/*
10-
- common/**/*
3+
workflow_call:
4+
inputs:
5+
naisEnv:
6+
required: true
7+
type: string
8+
VITE_APP_ORIGIN:
9+
required: true
10+
type: string
11+
XP_ORIGIN:
12+
required: true
13+
type: string
14+
HTML_RENDER_API:
15+
required: true
16+
type: string
17+
secrets:
18+
READER_TOKEN:
19+
required: true
20+
NAIS_WORKLOAD_IDENTITY_PROVIDER:
21+
required: true
22+
#on:
23+
# workflow_dispatch:
24+
# push:
25+
# branches:
26+
# - master
27+
# paths:
28+
# - package*.json
29+
# - xp-archive/**/*
30+
# - common/**/*
1131

1232
jobs:
1333
build-and-deploy:
@@ -35,11 +55,11 @@ jobs:
3555
run: |
3656
cat > .env <<EOF
3757
NODE_ENV=production
38-
VITE_APP_ORIGIN=https://cms-arkiv.ansatt.dev.nav.no
3958
APP_PORT=3499
4059
APP_BASEPATH=/xp
41-
XP_ORIGIN=https://www.dev.nav.no
42-
HTML_RENDER_API=http://nav-enonicxp-frontend-dev1/render-from-props
60+
VITE_APP_ORIGIN={{ inputs.VITE_APP_ORIGIN }}
61+
XP_ORIGIN={{ inputs.XP_ORIGIN }}
62+
HTML_RENDER_API={{ inputs.HTML_RENDER_API }}
4363
EOF
4464
- name: Build application
4565
run: npm run build
@@ -55,7 +75,7 @@ jobs:
5575
- name: Deploy application
5676
uses: nais/deploy/actions/deploy@v2
5777
env:
58-
CLUSTER: dev-gcp
78+
CLUSTER: {{ inputs.naisEnv }}-gcp
5979
RESOURCE: xp-archive/.nais/config.yml
6080
VAR: image=${{ steps.docker-push.outputs.image }}
61-
VARS: xp-archive/.nais/vars/dev.yml
81+
VARS: xp-archive/.nais/vars/{{ inputs.naisEnv }}.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build and deploy XP archive to dev
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- package*.json
9+
- xp-archive/**/*
10+
- common/**/*
11+
12+
jobs:
13+
build-and-deploy:
14+
name: Build and deploy to dev
15+
permissions:
16+
contents: "read"
17+
id-token: "write"
18+
uses: ./.github/workflows/.xp-archive-deploy.yml
19+
with:
20+
naisEnv: dev
21+
VITE_APP_ORIGIN: https://cms-arkiv.ansatt.dev.nav.no
22+
XP_ORIGIN: https://www.dev.nav.no
23+
HTML_RENDER_API: http://nav-enonicxp-frontend-dev1/render-from-props

0 commit comments

Comments
 (0)