BE CD for Dev #300
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 | |
deploy: | |
needs: build | |
timeout-minutes: 2 | |
runs-on: [ self-hosted, linux, ARM64, dev ] | |
steps: | |
- name: Download artifact file | |
uses: actions/download-artifact@v4 | |
with: | |
name: app-artifact | |
path: ~/app | |
- name: Replace application to latest | |
run: sudo sh ~/scripts/replace-new-version.sh | |
- name: Health check latest application | |
run: sudo sh ~/scripts/health-check.sh |