Skip to content

Changes (#33)

Changes (#33) #37

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