|
63 | 63 | value: ${{ jobs.build_image.outputs.image }}
|
64 | 64 |
|
65 | 65 | 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 }} |
0 commit comments