-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 2.03 KB
/
build.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
REGISTRY: europe-north1-docker.pkg.dev/artifact-registry-5n/dapla-pseudo-maven
IMAGE: tink-fpe-java
TAG: ${{ github.ref_name }}-${{ github.sha }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: zulu
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected]
with:
workload_identity_provider: "projects/848539402404/locations/global/workloadIdentityPools/gh-actions/providers/gh-actions"
service_account: "gh-actions-dapla-pseudo@artifact-registry-5n.iam.gserviceaccount.com"
token_format: access_token
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Maven release
id: release_jar
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
mvn --batch-mode -P ssb-bip package
ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
ARTIFACT_PATH=$(realpath ./target/$ARTIFACT_ID-$VERSION.jar)
echo ${ARTIFACT_PATH}
ls -al ${ARTIFACT_PATH}
echo -n "artifact_path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
- name: Upload Assets
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
with:
upload_url: "https://uploads.github.com/repos/statisticsnorway/tink-fpe-java/releases/99443723/assets{?name,label}"
asset_path: ${{ steps.release_jar.outputs.artifact_glob }}