-
-
Notifications
You must be signed in to change notification settings - Fork 89
89 lines (74 loc) · 3.6 KB
/
ci.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
name: CI
#env:
# JDK_JAVA_OPTIONS: --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED
# MAVEN_USERNAME: ch4mpy
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
#server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
#server-username: MAVEN_USERNAME # env variable for username in deploy
#server-password: ${{ secrets.MAVEN_CENTRAL_TOKEN }} # env variable for token in deploy
#gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
#gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }} # env variable for GPG private key passphrase
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Make Maven Wrapper executable
if: contains(matrix.os, 'win') == false
run: chmod +x ./mvnw
- name: Build with Maven
run: ./mvnw clean install
- name: Set VERSION environment variable
run: |
echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker Build-Tag-Push gateway ${{ env.VERSION }}
run: |
./mvnw -pl :bff-gateway spring-boot:build-image
docker tag bff-gateway:${{ env.VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/bff-gateway
docker push ${{ secrets.DOCKERHUB_USERNAME }}/bff-gateway
- name: Docker Build-Tag-Push API ${{ env.VERSION }}
run: |
./mvnw -pl :bff-greetings-api spring-boot:build-image
docker tag bff-greetings-api:${{ env.VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/bff-greetings-api
docker push ${{ secrets.DOCKERHUB_USERNAME }}/bff-greetings-api
- name: Docker Build-Tag-Push BFF Angular UI
uses: docker/build-push-action@v4
with:
context: ./samples/tutorials/bff/angular
file: ./samples/tutorials/bff/angular/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/bff-angular-ui
- name: Docker Build-Tag-Push resource-server_with_ui ${{ env.VERSION }}
run: |
./mvnw -pl :resource-server_with_ui spring-boot:build-image
docker tag resource-server_with_ui:${{ env.VERSION }} ${{ secrets.DOCKERHUB_USERNAME }}/resource-server_with_ui
docker push ${{ secrets.DOCKERHUB_USERNAME }}/resource-server_with_ui
- name: Rollout Restart OVH demo-bff
run: |
mkdir ${HOME}/.kube
echo ${{ secrets.OVH_KUBECONFIG }} | base64 --decode > ${HOME}/.kube/config
kubectl config use-context ovh
kubectl rollout restart -n demo-bff deployment.apps/bff-angular-ui deployment.apps/bff-gateway deployment.apps/bff-greetings-api
kubectl rollout restart -n demo-crs deployment.apps/client-and-resource-server