BE CD for Dev #8
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/** | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew clean bootJar | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v4 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: docker build ./Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/ddangkong-api-dev:latest | |
- name: Push Docker image | |
run: docker push ${{ secrets.DOCKER_USERNAME }}/ddangkong-api-dev:latest | |
deploy: | |
runs-on: [self-hosted, linux, ARM64] # Self hosted runner 사용 | |
steps: | |
- name: Pull docker image | |
run: docker pull ${{ secrets.DOCKER_USERNAME }}/ddangkong-api-dev:latest |