cicd : remove pull request trigger #11
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: Wooyah CI/CD with Gradle | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew clean build --exclude-task test | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: wooyah | |
path: build/libs/*.jar | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: wooyah | |
- name: SCP transfer | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SSH_USER }} | |
port: ${{ secrets.SSH_PORT }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
source: "*.jar" | |
target: "~/" | |
- name: Execute remote commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
cd ${{ secrets.DIST_PATH }} | |
./restart.sh |