-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (80 loc) · 2.69 KB
/
release.yml
File metadata and controls
93 lines (80 loc) · 2.69 KB
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
name: Release
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAMESPACE: ${{ github.repository_owner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Temurin JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Compile sources
run: |
mkdir -p build/classes
find src -name '*.java' > sources.txt
javac -d build/classes @sources.txt
- name: Package console jar
run: |
jar --create --file build/banking-console.jar --main-class banking.BankingApplication -C build/classes .
- name: Package API jar
run: |
jar --create --file build/banking-api.jar --main-class banking.api.ApiApplication -C build/classes .
- name: Run migration script
env:
BANKING_DATA_PATH: ${{ github.workspace }}/artifacts/data/banking_state.properties
run: |
mkdir -p artifacts/data
bash deploy/scripts/run-migrations.sh
- name: Run persistence smoke test
run: java -cp build/classes banking.test.PersistenceSmokeTest
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push console image
uses: docker/build-push-action@v5
with:
context: .
file: deploy/Dockerfile.console
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/banking-console:${{ github.ref_name }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/banking-console:latest
- name: Build and push API image
uses: docker/build-push-action@v5
with:
context: .
file: deploy/Dockerfile.api
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/banking-api:${{ github.ref_name }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/banking-api:latest
- name: Upload workflow artifacts
uses: actions/upload-artifact@v4
with:
name: banking-system-${{ github.ref_name }}
path: |
build/banking-console.jar
build/banking-api.jar
- name: Publish GitHub release
uses: softprops/action-gh-release@v2
with:
files: |
build/banking-console.jar
build/banking-api.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}