Skip to content

Commit 080e932

Browse files
authored
Create build_deploy_preprod.yml
1 parent c6cd858 commit 080e932

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Deploy to PREPROD
5+
6+
on:
7+
push:
8+
branches: [ feature/selenium4 ]
9+
# temporary disabled due to qa deployements during unmerged pull requests
10+
# pull_request:
11+
# branches: [ master ]
12+
13+
jobs:
14+
15+
build:
16+
name: build and deploy
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Public IP
20+
id: ip
21+
uses: haythem/public-ip@v1.3
22+
- name: Print Public IP
23+
run: |
24+
echo ${{ steps.ip.outputs.ipv4 }}
25+
echo ${{ steps.ip.outputs.ipv6 }}
26+
- uses: actions/checkout@v2
27+
- name: Set up JDK 11
28+
uses: actions/setup-java@v2
29+
with:
30+
java-version: '11'
31+
distribution: 'adopt'
32+
cache: maven
33+
- name: Build with Maven
34+
run: |
35+
cd source
36+
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn clean install --file pom.xml
37+
- name: Push file to core VM
38+
env:
39+
source-war: 'target/*.war'
40+
source-zip: 'target/*.zip'
41+
destination: 'debian@vm.cerberus-testing.org:/opt/delivery/'
42+
run: |
43+
cd source
44+
echo "${{secrets.DEPLOY_KEY}}" > deploy_key
45+
chmod 600 ./deploy_key
46+
sudo rsync -chav \
47+
-e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \
48+
${{env.source-war}} ${{env.destination}}
49+
sudo rsync -chav \
50+
-e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \
51+
${{env.source-zip}} ${{env.destination}}
52+
- name: Deploy to PREPROD
53+
run: |
54+
cd source
55+
echo "${{secrets.DEPLOY_KEY}}" > deploy_key
56+
chmod 600 ./deploy_key
57+
ssh -i ./deploy_key -o StrictHostKeyChecking=no debian@vm.cerberus-testing.org "/opt/bin/deployPREPROD.sh /opt/delivery/`find -type f -name cerberus-core-selenium4*war | sed 's/.\/target\///g'`"

0 commit comments

Comments
 (0)