-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (41 loc) · 1.38 KB
/
buildAndDeploy.yaml
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
name: Build and deploy JAR app
on:
push:
branches: [main]
workflow_dispatch:
inputs:
version:
description: 'Image version'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: '21'
- name: Build with Maven
run: mvn clean package -Pproduction -DskipTests
- name: Build container image
run: docker build -t registry.digitalocean.com/testregistryaleks/javaexample:1 .
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITAL_OCEAN }}
- name: Log in to DigitalOcean Container Registry with short-lived credentials
run: doctl registry login --expiry-seconds 600
- name: Push image to DigitalOcean Container Registry
run: docker push registry.digitalocean.com/testregistryaleks/javaexample:1
- name: deploy application to droplet
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
export PATH=$PATH:/home/samic/bin
source ~/.profile
bash ./deploy.sh