This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
chore: submodule 업데이트 #102
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: CICD for Backend Development | |
on: | |
push: | |
branches: | |
- develop | |
paths: | |
- "backend/**" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
## jdk setting | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.SUBMODULE_TOKEN }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "temurin" # https://github.com/actions/setup-java | |
cache: gradle | |
## gradle caching | |
- name: Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.gradle/caches | |
.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}- | |
## gradle build | |
- name: Test with Gradle | |
run: | | |
cd ./backend | |
./gradlew test | |
- name: Build with Gradle | |
run: | | |
cd ./backend | |
./gradlew build -x test | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile-dev | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/dong-gle-backend-dev:latest | |
platforms: linux/amd64 | |
deploy: | |
needs: build | |
uses: ./.github/workflows/deploy-dev.yml | |
secrets: inherit |