-
Notifications
You must be signed in to change notification settings - Fork 8
56 lines (54 loc) · 1.68 KB
/
workflow.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
name: Test and Build
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java_version: [ 17, 21 ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java_version }}
distribution: 'temurin'
- name: Run Maven tests
run: mvn test --no-transfer-progress --file pom.xml
deploy:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Set outputs
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: commonworkflowscheduler
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
logout: true
tags: commonworkflowscheduler/kubernetesscheduler:${{ steps.vars.outputs.sha_short }}, commonworkflowscheduler/kubernetesscheduler:latest, commonworkflowscheduler/kubernetesscheduler:${{ steps.vars.outputs.version }}