-
-
Notifications
You must be signed in to change notification settings - Fork 101
57 lines (53 loc) · 1.89 KB
/
build_deploy_qa.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
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Deploy to QA
on:
push:
branches: [ master ]
# temporary disabled due to qa deployements during unmerged pull requests
# pull_request:
# branches: [ master ]
jobs:
build:
name: build and deploy
runs-on: ubuntu-latest
steps:
- name: Public IP
id: ip
uses: haythem/[email protected]
- name: Print Public IP
run: |
echo ${{ steps.ip.outputs.ipv4 }}
echo ${{ steps.ip.outputs.ipv6 }}
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: |
cd source
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install --file pom.xml
- name: Push file to core VM
env:
source-war: 'target/*.war'
source-zip: 'target/*.zip'
destination: '[email protected]:/opt/delivery/'
run: |
cd source
echo "${{secrets.DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
sudo rsync -chav \
-e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \
${{env.source-war}} ${{env.destination}}
sudo rsync -chav \
-e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \
${{env.source-zip}} ${{env.destination}}
- name: Deploy to QA
run: |
cd source
echo "${{secrets.DEPLOY_KEY}}" > deploy_key
chmod 600 ./deploy_key
ssh -i ./deploy_key -o StrictHostKeyChecking=no [email protected] "/opt/bin/deployQA.sh /opt/delivery/`find -type f -name cerberus-core*war | sed 's/.\/target\///g'`"