BE CD for Dev #314
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: BE CD for Dev | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "develop" ] | |
paths: | |
- backend/** | |
jobs: | |
build: | |
timeout-minutes: 2 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setting dev-secret.yml | |
run: | | |
echo "${{ secrets.DEV_SECRET_YML }}" > ./src/main/resources/dev-secret.yml | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: bootJar with Gradle | |
run: ./gradlew bootJar -PcreateRestDocs | |
- name: Change artifact file name | |
run: mv build/libs/*.jar build/libs/app.jar | |
- name: Upload artifact file | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-artifact | |
path: ./backend/build/libs/app.jar | |
if-no-files-found: error | |
- name: Upload deploy scripts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deploy-scripts | |
path: ./backend/scripts/dev/ | |
if-no-files-found: error | |
deploy: | |
needs: build | |
timeout-minutes: 2 | |
runs-on: [ dev, X64, Linux ] | |
steps: | |
- name: Download artifact file | |
uses: actions/download-artifact@v4 | |
with: | |
name: app-artifact | |
path: ~/app | |
- name: Download deploy scripts | |
uses: actions/download-artifact@v4 | |
with: | |
name: deploy-scripts | |
path: ~/app/scripts | |
- name: Replace application to latest | |
run: sudo sh ~/app/scripts/replace-new-version.sh | |
- name: Health check latest application | |
run: sudo sh ~/app/scripts/health-check.sh |