๐ฆ๏ธ [CHORE] Sticker ์นดํ ๊ณ ๋ฆฌ ๋ณ๊ฒฝ #116
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: CD | |
on: | |
push: | |
branches: [ "develop" ] | |
jobs: | |
deploy-ci: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: '17' | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Read secrets from AWS Secrets Manager into environment variables | |
uses: abhilash1in/aws-secrets-manager-action@v2.1.0 | |
with: | |
secrets: | | |
/secret/lequu | |
parse-json: false | |
- name: application-secret.properties ์์ฑ (ํ๊ฒฝ๋ณ์๊ฐ AWS Secrets Manager๋ณด๋ค ๋น ๋ฅด๊ฒ ๋ก๋๋์ด์ผ ํ ๋) | |
run: | | |
cd src/main/resources | |
echo "${{ secrets.PROPERTIES }}" > ./application-secret.properties | |
- name: Build | |
run: | | |
chmod +x gradlew | |
./gradlew build -x test | |
shell: bash | |
### CD flow ์์ ### | |
- name: Docker build ๊ฐ๋ฅํ๋๋ก ํ๊ฒฝ ์ค์ | |
uses: docker/setup-buildx-action@v2.9.1 | |
- name: Docker Hub์ ๋ก๊ทธ์ธ | |
uses: docker/login-action@v2.2.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }} | |
- name: Docker image ๋น๋ ๋ฐ ํธ์ | |
run: | | |
docker build --platform linux/amd64 \ | |
--build-arg AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY }} \ | |
--build-arg AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_KEY }} \ | |
--build-arg AWS_DEFAULT_REGION=ap-northeast-2 \ | |
--build-arg AWS_OUTPUT_FORMAT=None \ | |
-t lequu/lequu-server . | |
docker push lequu/lequu-server | |
deploy-cd: | |
needs: deploy-ci | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: ๋์ปค ์ปจํ ์ด๋ ์คํ | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.RELEASE_SERVER_IP }} | |
username: ${{ secrets.RELEASE_SERVER_USER }} | |
key: ${{ secrets.RELEASE_SERVER_KEY }} | |
script: | | |
cd ~ | |
./deploy.sh | |
docker image prune -f |