-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (29 loc) · 1.05 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
name: Build
# when to trigger a pipeline
on:
push:
branches: [ "**" ] # "**" it will trigger for any branch, if "*" if branch name contains '/' it will not work
# we can have multiple jobs build API, build UI
jobs:
build-bookmarker-api:
name: Build bookmarker-api
runs-on: ubuntu-latest # you can specify ubuntu version
defaults:
run:
working-directory: ./bookmarker-api
steps:
- uses: actions/checkout@v4 # checks out code from github
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin' # there are multiple distribution operations.
cache: 'maven'
- name: Build with Maven
run: ./mvnw verify
- if: ${{github.ref == 'refs/heads/main' }}
name: Build and Publish Docker Image
run:
./mvwn clean package job:dockerBuild -DskipTests
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push ${{ secrets.DOCKER_USERNAME }}/bookmarker-api