-
Notifications
You must be signed in to change notification settings - Fork 8
88 lines (71 loc) · 2.61 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build and Publish Revision
concurrency:
group: release
on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- "mediator/**"
- "*.sbt"
- "project/**"
- "webapp/**"
jobs:
build:
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
runs-on: ubuntu-latest
env:
GITHUB_ACTOR: "hyperledger-bot"
GITHUB_ACTOR_EMAIL: "[email protected]"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true
SBT_OPTS: -Xmx2G
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup Java and Scala
uses: olafurpg/setup-scala@v14
with:
java-version: [email protected]
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ env.GITHUB_ACTOR }}
password: ${{ env.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Get short commit hash
run: echo "COMMIT_HASH=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Set build number
run: echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Extract version from version.sbt
id: get_version
run: |
VERSION=$(grep -Eo 'version := "[^"]+"' version.sbt | sed 's/version := "//; s/"//; s/-SNAPSHOT//')
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Set build version
run: echo "BUILD_VERSION=${{ env.VERSION }}-${{ env.BUILD_NUMBER }}-${{ env.COMMIT_HASH }}" >> $GITHUB_ENV
- name: Build and push Docker image
env:
NODE_OPTIONS: --openssl-legacy-provider
run: |
sbt -J-Xmx5120m "set ThisBuild / version := \"${{ env.BUILD_VERSION }}\"" "docker:stage"
docker buildx build --platform=linux/arm64,linux/amd64 --push -t ghcr.io/hyperledger/identus-mediator:${{ env.BUILD_VERSION}} ./mediator/target/docker/stage
- name: Trigger helm chart update
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
repository: input-output-hk/atala-prism-helm-charts
event-type: build-chart-package
client-payload: '{"version": "${{ env.BUILD_VERSION }}", "chart": "mediator"}'