-
Notifications
You must be signed in to change notification settings - Fork 2
90 lines (73 loc) · 1.97 KB
/
bpd.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
90
name: Build, publish & deploy
on:
push:
paths-ignore:
- "README.md"
branches:
- master
pull_request:
paths-ignore:
- "README.md"
types:
- opened
- synchronize
- reopened
branches:
- master
jobs:
build:
name: Build for JDK ${{ vars.JAVA_VERSION }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: ${{ vars.JAVA_DISTRIBUTION }}
java-version: ${{ vars.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build
run: ./gradlew clean build
- name: Run tests
run: ./gradlew test
publish:
name: Publish artifacts
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
needs: build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: ${{ vars.JAVA_DISTRIBUTION }}
java-version: ${{ vars.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build and push image
env:
IMAGE_TAG: ${{ github.sha }}
run: ./gradlew jib -Djib.to.auth.username=${{ secrets.DOCKER_USERNAME }} -Djib.to.auth.password=${{ secrets.DOCKER_ACCESS_TOKEN }}
deploy:
name: Deploy to Kubernetes cluster
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v3
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Get Kubernetes context
uses: azure/aks-set-context@v3
with:
resource-group: artify
cluster-name: artify
- name: Deploy application
uses: azure/k8s-deploy@v4
with:
manifests: ./docker/kubernetes
action: deploy
strategy: basic
pull-images: false