-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (41 loc) · 1.62 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
name: accounting
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: start postgres and build
run: |
docker pull postgres:12
docker run \
-e POSTGRES_HOST_AUTH_METHOD=trust \
-p 127.0.0.1:5432:5432 \
-v $(realpath .github/workflows/data/database.sql):/docker-entrypoint-initdb.d/database.sql \
postgres:12 &
sleep 5
./gradlew -Dgradle.user.home=.github/workflows/data flywayMigrate
./gradlew -Dgradle.user.home=.github/workflows/data build
./gradlew -q ghActionVersion
id: build
- name: Upload jar
uses: actions/upload-artifact@v1
with:
name: accounting-${{steps.build.outputs.accounting_version}}.jar
path: build/libs/accounting-${{steps.build.outputs.accounting_version}}.jar
- name: deploy
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
eval "$(ssh-agent -s)"
ssh-add - <<< "${{ secrets.deploy_key }}"
mkdir -p ~/.ssh
echo "${{ secrets.deploy_host }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCIzicRrz0v4YSCsr7y6IBNUEjZNxO+V8f0LhdC96JKGopIIK3Ivz3mHqUSORY6Cq+/CDyqanqWkiYTDi0quKm8=" > ~/.ssh/known_hosts
< "build/libs/accounting-${{steps.build.outputs.accounting_version}}.jar" \
ssh accounting-deploy@${{ secrets.deploy_host }}