mirror of
https://github.com/ysoftdevs/oauth-playground-server.git
synced 2026-01-18 01:27:43 +01:00
Update build_and_deploy.yml
This commit is contained in:
34
.github/workflows/build_and_deploy.yml
vendored
34
.github/workflows/build_and_deploy.yml
vendored
@@ -4,11 +4,33 @@ on:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/build.yml
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v3.13.0
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '20'
|
||||
- name: Build project
|
||||
run: ./mvnw install
|
||||
deploy:
|
||||
needs: build
|
||||
uses: ./.github/workflows/deploy.yml
|
||||
secrets:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
SSH_HOST: ${{ secrets.SSH_HOST }}
|
||||
SSH_USER: ${{ secrets.SSH_USER }}
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: oauth-playground.online
|
||||
url: https://sso.oauth-playground.online
|
||||
steps:
|
||||
- name: Install SSH Key
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
|
||||
- name: Adding Known Hosts
|
||||
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
- name: Stop service
|
||||
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "systemctl stop OAuthServer"
|
||||
- name: Deploy with rsync
|
||||
run: rsync -avz /home/runner/work/oauth-playground-server/oauth-playground-server/target/oauth-playground-server-1.0.0-SNAPSHOT-runner.jar ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/oauth-online-server
|
||||
- name: Start service
|
||||
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "systemctl start OAuthServer"
|
||||
|
||||
Reference in New Issue
Block a user