Skip to content

Commit 35709b8

Browse files
committed
automatic release
1 parent 01b6560 commit 35709b8

File tree

4 files changed

+98
-74
lines changed

4 files changed

+98
-74
lines changed
+70-70
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
11
name: Build and deploy XP archive
22
on:
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
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
2222

2323
jobs:
24-
build-and-deploy:
25-
name: Build and deploy
26-
runs-on: ubuntu-latest
27-
environment: ${{ inputs.naisEnv }}-xp
28-
permissions:
29-
contents: "read"
30-
id-token: "write"
31-
steps:
32-
- name: Checkout repo
33-
uses: actions/checkout@v4
34-
- name: Setup node.js
35-
uses: actions/setup-node@v4
36-
with:
37-
node-version: '22'
38-
registry-url: 'https://npm.pkg.github.com'
39-
cache: 'npm'
40-
cache-dependency-path: '**/package-lock.json'
41-
- name: Install dependencies
42-
run: npm ci --include-workspace-root --workspace=common --workspace=xp-archive
43-
env:
44-
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
45-
- name: Set env vars
46-
working-directory: xp-archive
47-
run: |
48-
cat > .env <<EOF
49-
NODE_ENV=production
50-
APP_PORT=3499
51-
APP_BASEPATH=/xp
52-
VITE_APP_ORIGIN=${{ inputs.VITE_APP_ORIGIN }}
53-
XP_ORIGIN=${{ inputs.XP_ORIGIN }}
54-
HTML_RENDER_API=${{ inputs.HTML_RENDER_API }}
55-
EOF
56-
- name: Build application
57-
run: npm run build
58-
working-directory: xp-archive
59-
- name: Build and push docker image
60-
uses: nais/docker-build-push@v0
61-
id: docker-push
62-
with:
63-
team: personbruker
64-
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
65-
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
66-
dockerfile: Dockerfile_xp
67-
image_suffix: ${{ inputs.naisEnv }}
68-
- name: Deploy application
69-
uses: nais/deploy/actions/deploy@v2
70-
env:
71-
CLUSTER: ${{ inputs.naisEnv }}-gcp
72-
RESOURCE: xp-archive/.nais/config.yml
73-
VAR: image=${{ steps.docker-push.outputs.image }}
74-
VARS: xp-archive/.nais/vars/${{ inputs.naisEnv }}.yml
24+
build-and-deploy:
25+
name: Build and deploy
26+
runs-on: ubuntu-latest
27+
environment: ${{ inputs.naisEnv }}-xp
28+
permissions:
29+
contents: read
30+
id-token: write
31+
steps:
32+
- name: Checkout repo
33+
uses: actions/checkout@v4
34+
- name: Setup node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 22
38+
registry-url: 'https://npm.pkg.github.com'
39+
cache: 'npm'
40+
cache-dependency-path: '**/package-lock.json'
41+
- name: Install dependencies
42+
run: npm ci --include-workspace-root --workspace=common --workspace=xp-archive
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
45+
- name: Set env vars
46+
working-directory: xp-archive
47+
run: |
48+
cat > .env <<EOF
49+
NODE_ENV=production
50+
APP_PORT=3499
51+
APP_BASEPATH=/xp
52+
VITE_APP_ORIGIN=${{ inputs.VITE_APP_ORIGIN }}
53+
XP_ORIGIN=${{ inputs.XP_ORIGIN }}
54+
HTML_RENDER_API=${{ inputs.HTML_RENDER_API }}
55+
EOF
56+
- name: Build application
57+
run: npm run build
58+
working-directory: xp-archive
59+
- name: Build and push docker image
60+
uses: nais/docker-build-push@v0
61+
id: docker-push
62+
with:
63+
team: personbruker
64+
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
65+
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
66+
dockerfile: Dockerfile_xp
67+
image_suffix: ${{ inputs.naisEnv }}
68+
- name: Deploy application
69+
uses: nais/deploy/actions/deploy@v2
70+
env:
71+
CLUSTER: ${{ inputs.naisEnv }}-gcp
72+
RESOURCE: xp-archive/.nais/config.yml
73+
VAR: image=${{ steps.docker-push.outputs.image }}
74+
VARS: xp-archive/.nais/vars/${{ inputs.naisEnv }}.yml

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
build-and-deploy:
1414
name: Build and deploy to dev
1515
permissions:
16-
contents: 'read'
17-
id-token: 'write'
16+
contents: read
17+
id-token: write
1818
uses: ./.github/workflows/.xp-archive-deploy.yml
1919
with:
2020
naisEnv: dev

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

+22-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
build-and-deploy:
1414
name: Build and deploy to prod
1515
permissions:
16-
contents: 'read'
17-
id-token: 'write'
16+
contents: read
17+
id-token: write
1818
uses: ./.github/workflows/.xp-archive-deploy.yml
1919
with:
2020
naisEnv: prod
@@ -24,3 +24,23 @@ jobs:
2424
secrets:
2525
READER_TOKEN: ${{ secrets.READER_TOKEN }}
2626
NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
27+
28+
release:
29+
name: Create a new release
30+
needs: build-and-deploy
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: write
34+
id-token: write
35+
steps:
36+
- name: Generate unique tag name
37+
run: echo "TAG_NAME=$(date +%s)" >> $GITHUB_ENV
38+
- name: Create GitHub Release
39+
uses: softprops/action-gh-release@v2
40+
with:
41+
target_commitish: main
42+
tag_name: release/prod@${{ env.TAG_NAME }} # Generates a unique tag using timestamp
43+
name: Release ${{ github.ref_name }}
44+
generate_release_notes: true
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # This is a PAT with repo permissions

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ npm run start-local -C xp-archive
5858

5959
Hvis iframes ikke vises, sjekk om du får cors-issues i srcdoc. Disse vil oppstå hvis du kjører nav-enonicxp-frontend i dev-modus og ikke i prod-modus.
6060

61+
## Prodsetting
62+
63+
Lag en PR til main, og merge inn etter godkjenning (En automatisk release vil oppstå ved deploy til main)
64+
6165
## <a name="enonic-legacy"></a> Enonic CMS legacy arkiv (2006-2019)
6266

6367
Dette er et arkiv av innhold fra Enonic CMS, som Nav benyttet fra 2006-2019. Arkivet har to deler: SBS (nav.no og annet åpent innhold) og FSS (intranett).

0 commit comments

Comments
 (0)