refactor: get userinfo 메시지 변경 #227
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: Docker Hub Push for SpringBoot 17 | |
on: | |
push: | |
branches: | |
- "alarm/develop" | |
- "auth/develop" | |
- "chatting/develop" | |
- "feed/develop" | |
- "gateway/develop" | |
- "discovery/develop" | |
- "music/develop" | |
- "playlist/develop" | |
- "streaming/develop" | |
- "user/develop" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Environment Variables | |
run: | | |
BRANCH_NAME=$(echo $GITHUB_REF | awk -F'/' '{print $3}') | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
gradle- | |
- 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 src/backend/${{ env.BRANCH_NAME }}-server/gradlew | |
- name: Build with Gradle | |
run: | | |
cd src/backend/${{ env.BRANCH_NAME }}-server | |
./gradlew clean build -x test | |
- name: Build and Push Docker Image | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
BRANCH_NAME: ${{ env.BRANCH_NAME }} | |
run: | | |
if [ -n "$BRANCH_NAME" ]; then | |
DOCKERFILE_DIR="src/backend/$BRANCH_NAME-server" | |
else | |
echo "Failed to extract branch name from GITHUB_REF." | |
exit 1 | |
fi | |
cd $DOCKERFILE_DIR | |
docker run --privileged --rm tonistiigi/binfmt --install all | |
docker buildx create --use | |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD | |
docker buildx build --platform=linux/amd64,linux/arm64 -t $DOCKER_USERNAME/$BRANCH_NAME:latest . --push |