-
Notifications
You must be signed in to change notification settings - Fork 19
78 lines (76 loc) · 2.87 KB
/
build-oauth2-dev-server.yaml
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
name: build oauth2-dev-server
on:
push:
branches:
- 'main'
pull_request:
branches:
- main
jobs:
build-oauth2-dev-server:
runs-on: ubuntu-latest
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
paths: '["code/oauth2-dev-server/**", ".github/workflows/build-oauth2-dev-server.yaml"]'
cancel_others: 'true'
skip_after_successful_duplicate: 'false'
do_not_skip: '["workflow_dispatch"]'
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Checkout
uses: actions/checkout@v2
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Install xmllint
run: sudo apt-get update && sudo apt-get install libxml2-utils
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Set up JDK
uses: actions/[email protected]
with:
distribution: 'adopt'
java-version: '17'
cache: 'maven'
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Build
run: mvn -f code/oauth2-dev-server -B clean install
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Prepare
id: prep
run: |
PUSH=FALSE
pushd code
APP_EXISTS=$(make -s check-oads-image)
popd
if [[ $GITHUB_REF == refs/heads/* ]]; then
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
if [ "${{ github.event.repository.default_branch }}" = "$BRANCH_NAME" ] && [ "$APP_EXISTS" != 'true' ]; then
PUSH=TRUE
fi
elif [[ $GITHUB_REF == refs/pull/* ]]; then
BRANCH_NAME=$(echo ${{ github.event.pull_request.head.ref }} | sed -r 's#/+#-#g')
if [[ $BRANCH_NAME == release-* ]]; then
PUSH=TRUE
SUFFIX=rc
else
SUFFIX=pr-${{ github.event.number }}
fi
fi
echo ::set-output name=push::${PUSH}
echo ::set-output name=suffix::${SUFFIX}
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Set up QEMU
uses: docker/setup-qemu-action@v1
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- if: ${{ steps.skip_check.outputs.should_skip != 'true' && steps.prep.outputs.push == 'true'}}
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
name: Build and push
run: |
cd code
make build-oads SUFFIX=${{ steps.prep.outputs.suffix }} PUBLISH=${{ steps.prep.outputs.push }}