forked from balzac-lang/balzac
-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (103 loc) · 3.76 KB
/
maven.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Java CI with Maven
on:
push:
branches: [ "master" ]
paths-ignore:
- 'README.md'
pull_request:
branches: [ "master" ]
paths-ignore:
- 'README.md'
workflow_dispatch:
inputs:
latestTag:
description: Tag the image as 'latest'
type: boolean
default: false
testTag:
description: Tag the image as 'test'
type: boolean
default: false
jobs:
build:
name: Java 17 on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Install BitcoinJ dependency
env:
BITCOINJ_TAG: 0.16.13-LIB
run: |
[[ "${BITCOINJ_TAG}" == "" ]] && (echo "BITCOINJ_TAG is not set" && exit 1)
echo "Cleaning directory $PWD/bitcoinj"
rm -rf $PWD/bitcoinj || (echo "Unable to delete dir $PWD/bitcoinj" && exit 1)
echo "Cloning repo https://github.com/natzei/bitcoinj.git"
git clone https://github.com/natzei/bitcoinj.git || (echo "Unable to clone https://github.com/natzei/bitcoinj.git" && exit 1)
echo "Checking out tag $BITCOINJ_TAG"
git -C $PWD/bitcoinj checkout $BITCOINJ_TAG || (echo "Unable to checkout branch $BITCOINJ_TAG" && exit 1)
echo "Installing BitcoinJ $BITCOINJ_TAG"
$PWD/bitcoinj/gradlew -p $PWD/bitcoinj publishToMavenLocal -x test || (echo "Unable to install bitcoinj" && exit 1)
echo "Cleaning directory $PWD/bitcoinj"
rm -rf $PWD/bitcoinj || (echo "Unable to delete dir $PWD/bitcoinj" && exit 1)
- name: Build with Maven
run: mvn -B -f xyz.balzaclang.balzac.parent/ -DwarName=balzac -U clean install
- name: Upload war artifact
uses: actions/upload-artifact@v3
with:
name: war-artifact
path: xyz.balzaclang.balzac.web/target/balzac.war
- name: Upload war artifact to Github Releases
uses: fnkr/github-action-ghr@v1
if: ${{ github.ref_type == 'tag' }}
env:
GHR_PATH: xyz.balzaclang.balzac.web/target/balzac.war
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish coverage metrics to Coveralls.io
run: mvn -B -f xyz.balzaclang.balzac.lib/ jacoco:report coveralls:report -DrepoToken=${{ secrets.COVERALLS_REPO_TOKEN }}
docker-build:
runs-on: ubuntu-latest
name: Build multi-arch docker images
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download war artifact
uses: actions/download-artifact@v3
with:
name: war-artifact
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: balzaclang/balzac
tags: |
type=raw,value=latest,enable=${{ inputs.latestTag || false }}
type=raw,value=test,enable=${{ inputs.testTag || false }}
type=raw,value=test-{{sha}},enable=${{ inputs.testTag || false }}
type=raw,value={{tag}},enable=${{ github.ref_type == 'tag' }}
- name: Build Docker images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.ref_type == 'tag' }}
build-args: war=balzac.war
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}