Dev Server CD #78
Workflow file for this run
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: Dev Server CD | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: checkout branch | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.SUBMODULE_TOKEN }} | |
submodules: true | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: cache gradle | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: chmod gradle | |
run: chmod +x ./ | |
- name: build application | |
run: ./gradlew bootJar | |
- name: scp to dev server | |
uses: appleboy/scp-action@master | |
with: | |
username: ubuntu | |
host: ${{ secrets.DEV_PUBLIC_IP }} | |
key: ${{ secrets.DEV_PRIVATE_KEY }} | |
source: "./build/libs/*.jar" | |
target: "/home/ubuntu" | |
strip_components: 2 | |
- name: deploy application | |
uses: appleboy/ssh-action@master | |
with: | |
username: ubuntu | |
host: ${{ secrets.DEV_PUBLIC_IP }} | |
key: ${{ secrets.DEV_PRIVATE_KEY }} | |
script: | | |
sudo sh /home/ubuntu/deploy.sh | |
- name: send result to slack | |
if: always() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
author_name: Github Action CD | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |