Merge pull request #12 from hubo-gillajabi/HUBOBE-26-be-업적-구현 #27
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: ci-cd develop | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
types: [ closed ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: checkout source code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.ACTION_SECRETS}} | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'zulu' | |
- name: copy application.yml files from submodule | |
run: | | |
mkdir -p src/main/resources | |
cp -r BE-hubo-gillajabi-resources/resources/application*.yml src/main/resources/ | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: bootJar with gradle | |
run: ./gradlew bootJar | |
- name: update release | |
uses: release-drafter/release-drafter@v6 | |
with: | |
config-name: release-drafter.yml | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACTION_SECRETS }} | |
prerelease-identifier: 'dev' | |
- name: set docker tag | |
id: docker_tag | |
run: | | |
if [ "${{ github.event_name }}" == "push" ]; then | |
TAG=$(curl -sH "Authorization: token ${{ secrets.ACTION_SECRETS }}" \ | |
https://api.github.com/repos/${{ github.repository }}/releases?per_page=1 | jq -r 'map(select(.draft == true)) | .[0].tag_name') | |
if [ "$TAG" == "null" ]; then | |
TAG="${{ github.sha }}" | |
fi | |
elif [ "${{ github.event_name }}" == "release" ]; then | |
TAG="${{ github.event.release.tag_name }}" | |
else | |
TAG="latest" | |
fi | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
- name: docker login | |
uses: docker/login-action@v3.1.0 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_LOGIN_TOKEN }} | |
- name: build and push docker image | |
run: | | |
docker build -f Dockerfile-dev --platform linux/arm64/v8 -t ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:$TAG . | |
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:$TAG | |