-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (69 loc) · 2.58 KB
/
main.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master, develop, feature/test-actions-bug ]
pull_request:
branches: [ master, develop ]
defaults:
run:
shell: bash
jobs:
build:
name: Test, Build, Deploy
runs-on: ubuntu-latest
steps:
- name: PATH1
run: echo $PATH
- name: Checkout
uses: actions/checkout@v2
- name: Start NPM Cache
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: |
${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
${{runner.os}}-npm-
- name: Start Maven Cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{runner.os}}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{runner.os}}-m2-${{ hashFiles('**/pom.xml') }}
${{runner.os}}-m2-
- name: PATH2
run: echo $PATH
- name: Set up JDK 13
uses: actions/setup-java@v1
with:
java-version: 13
- name: PATH3
run: echo $PATH
- name: Compile with Maven
run: ./mvnw -B clean compile --file pom.xml
- name: Test with Maven
run: ./mvnw -B test --file pom.xml
- name: Build with Maven
run: ./mvnw -B package -DskipTests --file pom.xml
- name: Prepare SSH Key and Artefact
if: ${{github.ref == 'refs/heads/develop'}}
run: 'echo "$SSH_KEY" > key && /bin/chmod 700 key && /bin/chmod 700 target && /bin/chmod 700 target/card-games.jar'
shell: bash
env:
SSH_KEY: ${{secrets.KEY}}
- name: Upload Project to Dev Server
if: ${{github.ref == 'refs/heads/develop'}}
run: /usr/bin/scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key target/card-games.jar ${{secrets.USERNAME}}@${{secrets.HOST}}:${{secrets.PATH}}
- name: Deploy Project on Dev Server
if: ${{github.ref == 'refs/heads/develop'}}
run: /usr/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i key ${{secrets.USERNAME}}@${{secrets.HOST}} ${{secrets.RESTART_SERVICE}}
- name: Alert IFTTT
if: ${{github.ref == 'refs/heads/develop'}}
uses: distributhor/workflow-webhook@v1
env:
webhook_url: ${{secrets.IFTTT_URL}}
webhook_secret: ${{secrets.IFTTT_SECRET}}