-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (47 loc) · 1.39 KB
/
build-push.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
name: Build and push Docker container
on:
workflow_call:
outputs:
image:
description: 'The docker image'
value: ${{ jobs.build-and-push.outputs.image }}
inputs:
environment:
required: true
type: string
jobs:
build-and-push:
name: Build and push Docker container
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
packages: 'read'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com
scope: '@navikt'
cache: 'npm'
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set environment variables
run: cp environments/${{ inputs.environment }}.env .env
- name: Build
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: npm run build
- name: Build and push Docker image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: team-soknad
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
image_suffix: ${{ inputs.environment }}
outputs:
image: ${{ steps.docker-build-push.outputs.image }}