-
Notifications
You must be signed in to change notification settings - Fork 9
65 lines (54 loc) · 1.95 KB
/
continuous-deployment.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
name: Maven test & Docker build-push
on:
push:
branches: [ master ]
paths:
- 'argocd/helloworld/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set SHA8
run: echo ::set-env name=SHA8::$(git log --oneline -1 | awk '{print $1}')
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Set SHA8
run: echo ::set-env name=SHA8::$(git log --oneline -1 | awk '{print $1}')
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Set up JDK 11
uses: actions/[email protected]
with:
java-version: '11.0.8'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Build with Maven
run: |
cd argocd/helloworld
mvn clean install
- name: Docker Build
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }}
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
run: |
cd argocd/helloworld
docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}
docker build -t ${DOCKER_REPO}/helloworld:${SHA8} -f Dockerfile .
docker tag ${DOCKER_REPO}/helloworld:${SHA8} ${DOCKER_REGISTRY_HOST}/${DOCKER_REPO}/helloworld:${SHA8}
docker push ${DOCKER_REPO}/helloworld:${SHA8}
- name: Trigger Release Template
env:
XLR_USER: ${{ secrets.XLR_USER }}
XLR_PASS: ${{ secrets.XLR_PASS }}
XLR_URL: ${{ secrets.XLR_URL }}
run: |
cd argocd/helloworld
sed -i "s/PLACEHOLDER/$SHA8/g" start-release.yaml
curl -LO https://dist.xebialabs.com/public/xl-cli/22.0.0/linux-amd64/xl
chmod +x xl
./xl apply --xl-release-url=$XLR_URL --xl-release-username=$XLR_USER --xl-release-password=$XLR_PASS --file start-release.yaml
echo `./xl version`
rm xl