-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (56 loc) · 1.52 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
name: Build Flow
on:
pull_request:
branches:
- '*'
push:
branches:
- 'master'
env:
USERNAME: ${{ secrets.OSSRH_USERNAME }}
TOKEN: ${{ secrets.OSSRH_TOKEN }}
APPLICATION_PORT: '8080'
JWT_SECRET: secret
PRODUCT_URL: http://localhost:8081/product
AUTH_URL: http://localhost:8082/auth
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build with Gradle
run: gradle clean build
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: java-app
path: ./build/libs/API-Gateway-Admin-0.0.1-SNAPSHOT.jar
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
path: ./build/libs/
name: java-app
- name: Build Docker image
run: docker build -t test_image:latest .