Skip to content

Commit c28267d

Browse files
committed
automatic release
1 parent a1398f5 commit c28267d

7 files changed

+177
-177
lines changed

.github/workflows/build-image.yml

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -63,74 +63,74 @@ on:
6363
value: ${{ jobs.build_image.outputs.image }}
6464

6565
jobs:
66-
build_image:
67-
name: Build docker image
68-
runs-on: ubuntu-latest
69-
permissions:
70-
contents: read
71-
id-token: write
72-
environment: ${{ inputs.environment }}
73-
outputs:
74-
image: ${{ steps.docker-push.outputs.image }}
75-
steps:
76-
- name: Checkout repo
77-
uses: actions/checkout@v4
78-
- name: Setup node.js
79-
uses: actions/setup-node@v4
80-
with:
81-
node-version: 20
82-
registry-url: 'https://npm.pkg.github.com'
83-
cache: 'npm'
84-
- name: Set app environmment
85-
run: |
86-
cat > .env <<EOF
87-
ENV=${{ inputs.ENV }}
88-
NODE_ENV=${{ inputs.NODE_ENV }}
89-
ADMIN_ORIGIN=${{ inputs.ADMIN_ORIGIN }}
90-
APP_ORIGIN=${{ inputs.APP_ORIGIN }}
91-
DECORATOR_URL=${{ inputs.DECORATOR_URL }}
92-
XP_ORIGIN=${{ inputs.XP_ORIGIN }}
93-
TELEMETRY_URL=${{ inputs.TELEMETRY_URL }}
94-
REVALIDATOR_PROXY_ORIGIN=${{ inputs.REVALIDATOR_PROXY_ORIGIN }}
95-
FAILOVER_ORIGIN=${{ inputs.FAILOVER_ORIGIN }}
96-
IS_FAILOVER_INSTANCE=${{ inputs.IS_FAILOVER_INSTANCE }}
97-
INNLOGGINGSSTATUS_URL=${{ inputs.INNLOGGINGSSTATUS_URL }}
98-
NAVNO_SEARCH_API_URL=${{ inputs.NAVNO_SEARCH_API_URL }}
99-
MELDEKORT_API_URL=${{ inputs.MELDEKORT_API_URL }}
100-
ASSET_PREFIX=https://cdn.nav.no/personbruker/nav-enonicxp-frontend
101-
IMAGE_CACHE_DIR=/tmp/images
102-
NEXT_TELEMETRY_DISABLED=1
103-
EOF
104-
- name: Nextjs cache
105-
uses: actions/cache@v4
106-
with:
107-
path: ${{ github.workspace }}/.next/cache
108-
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}
109-
- name: Install dependencies
110-
run: npm ci
111-
env:
112-
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
113-
- name: Run linting
114-
run: npm run lint
115-
- name: Run tests
116-
run: npm run test
117-
- name: Build application
118-
run: npm run build
119-
env:
120-
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
121-
- name: Upload static files to Nav CDN
122-
uses: nais/deploy/actions/cdn-upload/v2@master
123-
with:
124-
team: personbruker
125-
source: ./.next/static
126-
destination: nav-enonicxp-frontend/_next
127-
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
128-
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
129-
- name: Build and push docker image
130-
uses: nais/docker-build-push@v0
131-
id: docker-push
132-
with:
133-
team: personbruker
134-
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
135-
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
136-
image_suffix: ${{ inputs.imagename }}
66+
build_image:
67+
name: Build docker image
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: read
71+
id-token: write
72+
environment: ${{ inputs.environment }}
73+
outputs:
74+
image: ${{ steps.docker-push.outputs.image }}
75+
steps:
76+
- name: Checkout repo
77+
uses: actions/checkout@v4
78+
- name: Setup node.js
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: 20
82+
registry-url: 'https://npm.pkg.github.com'
83+
cache: 'npm'
84+
- name: Set app environmment
85+
run: |
86+
cat > .env <<EOF
87+
ENV=${{ inputs.ENV }}
88+
NODE_ENV=${{ inputs.NODE_ENV }}
89+
ADMIN_ORIGIN=${{ inputs.ADMIN_ORIGIN }}
90+
APP_ORIGIN=${{ inputs.APP_ORIGIN }}
91+
DECORATOR_URL=${{ inputs.DECORATOR_URL }}
92+
XP_ORIGIN=${{ inputs.XP_ORIGIN }}
93+
TELEMETRY_URL=${{ inputs.TELEMETRY_URL }}
94+
REVALIDATOR_PROXY_ORIGIN=${{ inputs.REVALIDATOR_PROXY_ORIGIN }}
95+
FAILOVER_ORIGIN=${{ inputs.FAILOVER_ORIGIN }}
96+
IS_FAILOVER_INSTANCE=${{ inputs.IS_FAILOVER_INSTANCE }}
97+
INNLOGGINGSSTATUS_URL=${{ inputs.INNLOGGINGSSTATUS_URL }}
98+
NAVNO_SEARCH_API_URL=${{ inputs.NAVNO_SEARCH_API_URL }}
99+
MELDEKORT_API_URL=${{ inputs.MELDEKORT_API_URL }}
100+
ASSET_PREFIX=https://cdn.nav.no/personbruker/nav-enonicxp-frontend
101+
IMAGE_CACHE_DIR=/tmp/images
102+
NEXT_TELEMETRY_DISABLED=1
103+
EOF
104+
- name: Nextjs cache
105+
uses: actions/cache@v4
106+
with:
107+
path: ${{ github.workspace }}/.next/cache
108+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}
109+
- name: Install dependencies
110+
run: npm ci
111+
env:
112+
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
113+
- name: Run linting
114+
run: npm run lint
115+
- name: Run tests
116+
run: npm run test
117+
- name: Build application
118+
run: npm run build
119+
env:
120+
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
121+
- name: Upload static files to Nav CDN
122+
uses: nais/deploy/actions/cdn-upload/v2@master
123+
with:
124+
team: personbruker
125+
source: ./.next/static
126+
destination: nav-enonicxp-frontend/_next
127+
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
128+
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
129+
- name: Build and push docker image
130+
uses: nais/docker-build-push@v0
131+
id: docker-push
132+
with:
133+
team: personbruker
134+
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
135+
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
136+
image_suffix: ${{ inputs.imagename }}

.github/workflows/deploy-failover.dev.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ on:
1616
- dev2
1717

1818
jobs:
19-
deploy:
20-
uses: ./.github/workflows/deploy-to-nais.yml
21-
permissions:
22-
id-token: write
23-
with:
24-
image: ghcr.io/${{ github.repository }}:${{ github.event.inputs.image_name }}
25-
cluster: dev-gcp
26-
vars_file: vars-${{ github.event.inputs.app_env }}-failover.yml
27-
config_file: config-failover.yml
19+
deploy:
20+
uses: ./.github/workflows/deploy-to-nais.yml
21+
permissions:
22+
id-token: write
23+
with:
24+
image: ghcr.io/${{ github.repository }}:${{ github.event.inputs.image_name }}
25+
cluster: dev-gcp
26+
vars_file: vars-${{ github.event.inputs.app_env }}-failover.yml
27+
config_file: config-failover.yml

.github/workflows/deploy-failover.prod.yml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,39 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
build:
9-
uses: ./.github/workflows/build-image.yml
10-
permissions:
11-
contents: read
12-
id-token: write
13-
with:
14-
environment: prod-gcp:failover
15-
imagename: failover-prod
16-
ENV: prod
17-
ADMIN_ORIGIN: https://portal-admin.oera.no
18-
APP_ORIGIN: https://www.nav.no
19-
REVALIDATOR_PROXY_ORIGIN: http://nav-enonicxp-frontend-revalidator-proxy
20-
DECORATOR_URL: https://www.nav.no/dekoratoren
21-
XP_ORIGIN: https://www.nav.no
22-
TELEMETRY_URL: https://telemetry.nav.no/collect
23-
MELDEKORT_API_URL: https://meldekort-api.nav.no/meldekort/meldekort-api/api/person
24-
INNLOGGINGSSTATUS_URL: https://www.nav.no/person/nav-dekoratoren-api/auth
25-
NAVNO_SEARCH_API_URL: https://navno-search-api.nav.no/content/search-url
26-
FAILOVER_ORIGIN: https://www-failover.nav.no
27-
IS_FAILOVER_INSTANCE: true
28-
NODE_ENV: production
29-
secrets:
30-
READER_TOKEN: ${{ secrets.READER_TOKEN }}
31-
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
32-
NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
33-
deploy:
34-
uses: ./.github/workflows/deploy-to-nais.yml
35-
needs: build
36-
permissions:
37-
id-token: write
38-
with:
39-
image: ${{ needs.build.outputs.image }}
40-
cluster: prod-gcp
41-
vars_file: vars-prod-failover.yml
42-
config_file: config-failover.yml
43-
hpa_file: hpa-prod-failover.yml
8+
build:
9+
uses: ./.github/workflows/build-image.yml
10+
permissions:
11+
contents: read
12+
id-token: write
13+
with:
14+
environment: prod-gcp:failover
15+
imagename: failover-prod
16+
ENV: prod
17+
ADMIN_ORIGIN: https://portal-admin.oera.no
18+
APP_ORIGIN: https://www.nav.no
19+
REVALIDATOR_PROXY_ORIGIN: http://nav-enonicxp-frontend-revalidator-proxy
20+
DECORATOR_URL: https://www.nav.no/dekoratoren
21+
XP_ORIGIN: https://www.nav.no
22+
TELEMETRY_URL: https://telemetry.nav.no/collect
23+
MELDEKORT_API_URL: https://meldekort-api.nav.no/meldekort/meldekort-api/api/person
24+
INNLOGGINGSSTATUS_URL: https://www.nav.no/person/nav-dekoratoren-api/auth
25+
NAVNO_SEARCH_API_URL: https://navno-search-api.nav.no/content/search-url
26+
FAILOVER_ORIGIN: https://www-failover.nav.no
27+
IS_FAILOVER_INSTANCE: true
28+
NODE_ENV: production
29+
secrets:
30+
READER_TOKEN: ${{ secrets.READER_TOKEN }}
31+
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
32+
NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
33+
deploy:
34+
uses: ./.github/workflows/deploy-to-nais.yml
35+
needs: build
36+
permissions:
37+
id-token: write
38+
with:
39+
image: ${{ needs.build.outputs.image }}
40+
cluster: prod-gcp
41+
vars_file: vars-prod-failover.yml
42+
config_file: config-failover.yml
43+
hpa_file: hpa-prod-failover.yml

.github/workflows/deploy-to-nais.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
name: Deploy to nais k8s
2727
runs-on: ubuntu-latest
2828
permissions:
29-
id-token: "write"
29+
id-token: write
3030
steps:
3131
- name: Checkout repo
3232
uses: actions/checkout@v4

.github/workflows/deploy.dev1.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
build:
1616
uses: ./.github/workflows/build-image.yml
1717
permissions:
18-
contents: "read"
19-
id-token: "write"
18+
contents: read
19+
id-token: write
2020
with:
2121
environment: dev-gcp:dev1
2222
imagename: dev1-deploy
@@ -41,7 +41,7 @@ jobs:
4141
uses: ./.github/workflows/deploy-to-nais.yml
4242
needs: build
4343
permissions:
44-
id-token: "write"
44+
id-token: write
4545
with:
4646
image: ${{ needs.build.outputs.image }}
4747
cluster: dev-gcp

.github/workflows/deploy.dev2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
uses: ./.github/workflows/deploy-to-nais.yml
4242
needs: build
4343
permissions:
44-
id-token: "write"
44+
id-token: write
4545
with:
4646
image: ${{ needs.build.outputs.image }}
4747
cluster: dev-gcp

.github/workflows/deploy.prod.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,60 @@ on:
55
- main
66

77
jobs:
8-
build:
9-
uses: ./.github/workflows/build-image.yml
10-
permissions:
11-
contents: read
12-
id-token: write
13-
with:
14-
environment: prod-gcp
15-
imagename: release-${{ github.ref_name }}
16-
ENV: prod
17-
ADMIN_ORIGIN: https://portal-admin.oera.no
18-
APP_ORIGIN: https://www.nav.no
19-
REVALIDATOR_PROXY_ORIGIN: http://nav-enonicxp-frontend-revalidator-proxy
20-
DECORATOR_URL: https://www.nav.no/nav-dekoratoren
21-
XP_ORIGIN: https://www.nav.no
22-
TELEMETRY_URL: https://telemetry.nav.no/collect
23-
INNLOGGINGSSTATUS_URL: https://www.nav.no/person/nav-dekoratoren-api/auth
24-
NAVNO_SEARCH_API_URL: https://navno-search-api.nav.no/content/search-url
25-
RELEASE_TAG: ${{ github.ref_name }}
26-
MELDEKORT_API_URL: https://meldekort-api.nav.no/meldekort/meldekort-api/api/person
27-
FAILOVER_ORIGIN: https://www-failover.nav.no
28-
NODE_ENV: production
29-
secrets:
30-
READER_TOKEN: ${{ secrets.READER_TOKEN }}
31-
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
32-
NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
33-
deploy:
34-
uses: ./.github/workflows/deploy-to-nais.yml
35-
needs: build
36-
permissions:
37-
id-token: write
38-
with:
39-
image: ${{ needs.build.outputs.image }}
40-
cluster: prod-gcp
41-
vars_file: vars-prod.yml
42-
config_file: config.yml
43-
hpa_file: hpa-prod.yml
44-
deploy_valkey: true
8+
build:
9+
uses: ./.github/workflows/build-image.yml
10+
permissions:
11+
contents: read
12+
id-token: write
13+
with:
14+
environment: prod-gcp
15+
imagename: release-${{ github.ref_name }}
16+
ENV: prod
17+
ADMIN_ORIGIN: https://portal-admin.oera.no
18+
APP_ORIGIN: https://www.nav.no
19+
REVALIDATOR_PROXY_ORIGIN: http://nav-enonicxp-frontend-revalidator-proxy
20+
DECORATOR_URL: https://www.nav.no/nav-dekoratoren
21+
XP_ORIGIN: https://www.nav.no
22+
TELEMETRY_URL: https://telemetry.nav.no/collect
23+
INNLOGGINGSSTATUS_URL: https://www.nav.no/person/nav-dekoratoren-api/auth
24+
NAVNO_SEARCH_API_URL: https://navno-search-api.nav.no/content/search-url
25+
RELEASE_TAG: ${{ github.ref_name }}
26+
MELDEKORT_API_URL: https://meldekort-api.nav.no/meldekort/meldekort-api/api/person
27+
FAILOVER_ORIGIN: https://www-failover.nav.no
28+
NODE_ENV: production
29+
secrets:
30+
READER_TOKEN: ${{ secrets.READER_TOKEN }}
31+
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
32+
NAIS_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
33+
deploy:
34+
uses: ./.github/workflows/deploy-to-nais.yml
35+
needs: build
36+
permissions:
37+
id-token: write
38+
with:
39+
image: ${{ needs.build.outputs.image }}
40+
cluster: prod-gcp
41+
vars_file: vars-prod.yml
42+
config_file: config.yml
43+
hpa_file: hpa-prod.yml
44+
deploy_valkey: true
4545

46-
release:
47-
name: Create a new release
48-
needs: deploy
49-
runs-on: ubuntu-latest
50-
permissions:
51-
contents: write
52-
id-token: write
53-
steps:
54-
- name: Generate unique tag name
55-
run: echo "TAG_NAME=$(date +%s)" >> $GITHUB_ENV
56-
- name: Create GitHub Release
57-
uses: softprops/action-gh-release@v2
58-
with:
59-
target_commitish: main
60-
tag_name: release/prod@${{ env.TAG_NAME }} # Generates a unique tag using timestamp
61-
name: Release ${{ github.ref_name }}
62-
generate_release_notes: true
63-
env:
64-
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # This is a PAT with repo permissions
46+
release:
47+
name: Create a new release
48+
needs: deploy
49+
runs-on: ubuntu-latest
50+
permissions:
51+
contents: write
52+
id-token: write
53+
steps:
54+
- name: Generate unique tag name
55+
run: echo "TAG_NAME=$(date +%s)" >> $GITHUB_ENV
56+
- name: Create GitHub Release
57+
uses: softprops/action-gh-release@v2
58+
with:
59+
target_commitish: main
60+
tag_name: release/prod@${{ env.TAG_NAME }} # Generates a unique tag using timestamp
61+
name: Release ${{ github.ref_name }}
62+
generate_release_notes: true
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # This is a PAT with repo permissions

0 commit comments

Comments
 (0)