add user to ssh (unsafe) #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI/CD | |
on: [ push ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Install Gradle | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('build.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build JAR | |
run: ./gradlew dist | |
- name: Find .jar file | |
run: find . -type f -name "CoreBot.jar" | |
- name: Rename .jar file to prevent confusion with old bot | |
run: mv ./build/libs/CoreBot.jar ./build/libs/Message.jar | |
- name: Upload a Build Artifact To GitHub | |
uses: actions/[email protected] | |
with: | |
path: build/libs/Message.jar | |
- name: Deploy File To Cerg Host | |
uses: wlixcc/[email protected] | |
with: | |
username: ${{ secrets.HOST_USERNAME }} | |
server: ${{ secrets.HOST_SERVER_IP }} | |
password: ${{ secrets.HOST_PASSWORD }} | |
local_path: './build/libs/Message.jar' | |
remote_path: '/home/cergc/bots/CoreBot/build/libs' | |
sftpArgs: '-o ConnectTimeout=5' | |
- name: Start Message Bot | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST_SERVER_IP }} | |
username: cergc | |
password: ${{ secrets.HOST_PASSWORD }} | |
script: | | |
bash home/cergc/bots/CoreBot/build/libs/start_message_bot.sh |