-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
126 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,76 @@ | ||
name: deploy-dev | ||
name: CD-dev | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
types: [ "published" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
deploy-ci: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
- name: Checkout Latest Repo | ||
uses: actions/checkout@v3 | ||
# 최신 저장소에서 체크아웃 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'temurin' | ||
cache: gradle | ||
distribution: 'corretto' | ||
java-version: '17' | ||
# 자바 버전을 JDK 17로 설정 | ||
|
||
- name: Create application-secret.yml | ||
run: | | ||
pwd | ||
cd ./smeem-bootstrap/src/main/resources | ||
touch ./application-secret.yml | ||
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml | ||
cat ./application-secret.yml | ||
- name: Configure AWS credentials | ||
- 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-access-key-id: ${{ secrets.AWS_ACCESS_KEY_DEV }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_DEV }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
# AWS 자격 증명 설정 | ||
|
||
- name: Set FCM_JSON_PATH | ||
run: echo "FCM_JSON_PATH=smeem-output-notification/src/main/resources/firebase-config/smeem_fcm_dev.json" >> $GITHUB_ENV | ||
- name: Set FCM JSON File Path | ||
run: | | ||
echo "FCM_JSON_PATH=smeem-output-notification/src/main/resources/firebase-config/ \ | ||
smeem_fcm_dev.json" >> $GITHUB_ENV | ||
# FCM JSON 파일 위치 경로 설정 | ||
|
||
- name: Create FireBase JSON file From AWS | ||
- name: Create FCM JSON File from AWS | ||
run: aws s3 cp --region ap-northeast-2 ${{ secrets.AWS_S3_FCM_JSON_URI_DEV }} ${{ env.FCM_JSON_PATH }} | ||
# FCM JSON 파일 복사 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
shell: bash | ||
# gradlew 파일에 실행 권한 부여 | ||
|
||
- name: Build with Gradle | ||
run: | | ||
chmod +x ./gradlew | ||
./gradlew build -x test | ||
run: ./gradlew clean build -x test | ||
shell: bash | ||
# 그래들로 빌드 | ||
|
||
- name: Set docker | ||
- name: Set Docker | ||
uses: docker/[email protected] | ||
# 도커 설정 | ||
|
||
- name: Login docker | ||
- name: Login Docker | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME_DEV }} | ||
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN_DEV }} | ||
# 도커에 로그인 | ||
|
||
- name: Build docker image | ||
- name: Docker Build | ||
run: | | ||
docker build --platform linux/amd64 -t smeemdev/smeem-dev:latest -f Dockerfile-dev . | ||
docker push smeemdev/smeem-dev:latest | ||
deploy-cd: | ||
needs: build | ||
runs-on: ubuntu-20.04 | ||
needs: deploy-ci | ||
runs-on: ubuntu-latest | ||
# deploy-ci 이후 작업 실행 | ||
|
||
steps: | ||
- name: SSH로 서버 접속 | ||
- name: Connect to EC2 and Deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.RELEASE_SERVER_IP_DEV }} | ||
|
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