Merge pull request #29 from DoTheZ-Team/develop #25
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: Glue Auth Server CI/CD | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set environment yml file | |
run: | | |
mkdir ./src/main/resources | |
cd ./src/main/resources | |
touch ./application.yml | |
echo "${{ secrets.APPLICATION }}" >> ./application.yml | |
shell: bash | |
- name: Grant execute permission for gradlew | |
run : chmod +x gradlew | |
# gradlew 권한 변경 | |
- name: Grant execute permission for gradlew | |
run : chmod +x gradlew | |
- name: Build with Gradle | |
run: ./gradlew build | |
- name: Login KakaoCloud | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ secrets.GLUE_PROJECT }} | |
username: ${{ secrets.ACCESS_ID }} | |
password: ${{ secrets.ACCESS_SECRET }} | |
- name: Build and Push to KakaoCloud | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
push: true | |
tags: ${{ secrets.GLUE_PROJECT }}/glue-repository/glue-auth:${{ github.sha }} | |
update-manifest-state: | |
runs-on: ubuntu-latest | |
needs: build-and-push-image | |
steps: | |
- name: Checkout glue-msa-config repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ secrets.GIT_PROJECT }}/glue-msa-config | |
token: ${{ secrets.GIT_TOKEN}} | |
ref: "main" | |
- name: Install yq | |
run: sudo snap install yq | |
- name: Update image in deployment file | |
run: | | |
yq e '.spec.template.spec.containers[1].image = "${{ secrets.GLUE_PROJECT }}/glue-repository/glue-auth:${{ github.sha }}"' ./k8s-template/auth-deployment.yaml -i | |
- name: Commit and Push changes | |
run: | | |
git config --global user.email "${{ secrets.EMAIL }}" | |
git config --global user.name "${{ secrets.USERNAME }}" | |
git add . | |
git commit -m "[skip ci] Update auth-deployment.yaml" | |
git remote set-url origin https://${{ secrets.GIT_TOKEN }}@github.com/${{ secrets.GIT_PROJECT }}/glue-msa-config | |
git push --set-upstream origin main |