[feat] : build CI script 수정 #5
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: Build Api Server | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
- release/* | ||
- backend | ||
- feature/* | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java-version: [ 11 ] | ||
outputs: | ||
version: ${{ steps.get_version.outputs.BRANCH_NAME }} | ||
steps: | ||
- name: Check Out The Repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: ${{ matrix.java-version }} | ||
distribution: 'corretto' | ||
- name: Get the version | ||
id: get_version | ||
run: | | ||
RELEASE_VERSION_WITHOUT_V="$(cut -d'v' -f2 <<< ${GITHUB_REF#refs/*/})" | ||
echo ::set-output name=VERSION::$RELEASE_VERSION_WITHOUT_V | ||
#테스트 수행용 도커 컴포즈 | ||
- name: Start containers | ||
run: docker-compose up -d | ||
- name: Gradle Build | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Execute Gradle build | ||
run: ./gradlew :Recruit-Api:build --no-daemon | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# docker build / push to NCP Container Registry | ||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./Recruit-Api | ||
# image push 최적화 | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/econo-recruit:${{ steps.get_version.outputs.VERSION }} |