56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
name: Hadder
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2.3.4
|
|
- name: Set up JDK 15
|
|
uses: actions/setup-java@v1.4.3
|
|
with:
|
|
java-version: '15'
|
|
- name: Build with Maven
|
|
run: mvn -B package --file pom.xml
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: github.ref == 'refs/heads/master'
|
|
steps:
|
|
- uses: actions/checkout@v2.3.4
|
|
- name: Set up JDK 15
|
|
uses: actions/setup-java@v1.4.3
|
|
with:
|
|
java-version: '15'
|
|
- name: Build Final Jar
|
|
run: mvn clean compile assembly:single
|
|
- name: Copy folder content recursively to remote
|
|
uses: garygrossgarten/github-action-scp@release
|
|
with:
|
|
local: ./target/Hadder-Build.jar
|
|
remote: /root/bots/Hadder/Hadder-Build.jar
|
|
host: ${{ secrets.HOST }}
|
|
port: ${{ secrets.PORT }}
|
|
username: ${{ secrets.USERNAME }}
|
|
password: ${{ secrets.PASSWORD }}
|
|
- name: executing remote ssh commands using password
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ secrets.HOST }}
|
|
username: ${{ secrets.USERNAME }}
|
|
password: ${{ secrets.PASSWORD }}
|
|
port: ${{ secrets.PORT }}
|
|
script: /root/bots/Hadder/deploy.sh
|
|
- name: Send Webhook Notification
|
|
if: always()
|
|
env:
|
|
JOB_STATUS: ${{ job.status }}
|
|
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
|
|
HOOK_OS_NAME: ${{ runner.os }}
|
|
WORKFLOW_NAME: ${{ github.workflow }}
|
|
run: |
|
|
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
|
|
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
|
|
shell: bash
|