-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (50 loc) · 1.7 KB
/
.build.yaml
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
49
50
51
52
53
name: .build.yaml
on:
workflow_call:
outputs:
image:
description: "Docker image url"
value: ${{ jobs.build-and-publish.outputs.image }}
jobs:
build-and-publish:
name: Build & publish
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: 'read'
id-token: 'write'
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.gradlekey }}
dependency-graph: generate-and-submit
- name: Gradle test and build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew :apps:${{ github.workflow }}:build --configuration-cache
- name: Build and publish docker image
uses: nais/docker-build-push@v0
id: docker-build-push
env:
TRIVY_JAVA_DB_REPOSITORY: "public.ecr.aws/aquasecurity/trivy-java-db:1"
with:
team: etterlatte
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
docker_context: apps/${{ github.workflow }}/
image_suffix: ${{ github.workflow }}
tag: ${{ env.GITHUB_REF_SLUG }}
- name: Print docker tag
run: echo 'Docker-tag er ${{ steps.docker-build-push.outputs.image }} ' >> $GITHUB_STEP_SUMMARY