1+ # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+ # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+ name : Frontend Java CI with Maven
5+
6+ on : [push, pull_request]
7+ env :
8+ IMAGE_NAME : wings
9+
10+ jobs :
11+ build :
12+
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - uses : actions/checkout@v2
17+ - name : Set up JDK 8
18+ uses : actions/setup-java@v2
19+ with :
20+ java-version : ' 8'
21+ distribution : ' temurin'
22+ cache : maven
23+ - name : Build with Maven
24+ run : mvn -B package --file pom.xml
25+ env :
26+ GITHUB_USERNAME : ${{ secrets.GITHUB_USERNAME }}
27+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28+
29+ - run : mkdir staging && cp client/target/*.war staging
30+ - uses : actions/upload-artifact@v2
31+ with :
32+ name : Package
33+ path : staging
34+
35+ image :
36+ needs : [build]
37+ runs-on : ubuntu-latest
38+ steps :
39+ - uses : actions/checkout@v2
40+ - uses : actions/download-artifact@v2
41+ with :
42+ name : Package
43+ path : build/
44+
45+ - name : Build image
46+ run : |
47+ docker build --tag $IMAGE_NAME -f docker/frontend/Dockerfile .
48+
49+ - name : Login to DockerHub
50+ uses : docker/login-action@v1
51+ with :
52+ username : ${{ secrets.DOCKERHUB_USERNAME }}
53+ password : ${{ secrets.DOCKERHUB_TOKEN }}
54+
55+ - name : Push image
56+ run : |
57+ IMAGE_ID=ikcap/disk_frontend
58+ VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
59+ [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
60+ [ "$VERSION" == "master" ] && VERSION=latest
61+ echo IMAGE_ID=$IMAGE_ID
62+ echo VERSION=$VERSION
63+ docker tag $IMAGE_NAME $IMAGE_ID:$GITHUB_SHA
64+ docker push $IMAGE_ID:$GITHUB_SHA
65+ docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
66+ docker push $IMAGE_ID:$VERSION
0 commit comments