Deploy #44
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: github-action | |
# 해당 workflow가 언제 실행될 것인지에 대한 트리거를 지정 qqe | |
on: | |
pull_request: | |
branches: | |
- prod-deploy | |
# 수동으로 해당 workflow 실행 지정 | |
workflow_dispatch: | |
# workflow는 한개 이상의 job을 가지며, 각 job은 여러 step에 따라 단계를 나눌 수 있습니다.3 | |
env: | |
S3_BUCKET_NAME: runway-codedeploy | |
AWS_REGION: ap-northeast-2 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- run: touch ./src/main/resources/application.properties | |
- run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.properties | |
- run: cat ./src/main/resources/application.properties | |
- run: touch ./src/main/resources/AuthKey_3374Y294XA.p8 | |
- run: echo "${{ secrets.AUTH_KEY }}" > ./src/main/resources/AuthKey_3374Y294XA.p8 | |
- run: cat ./src/main/resources/AuthKey_3374Y294XA.p8 | |
- run: touch ./src/main/resources/application-prod.properties | |
- run: echo "${{ secrets.APPLICATION_PROD }}" > ./src/main/resources/application-prod.properties | |
- run: cat ./src/main/resources/application-prod.properties | |
- name: create-fcm-json | |
id: create-fcm-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: "runwayAccessKey.json" | |
json: ${{ secrets.FCM_JSON }} | |
dir: "./src/main/resources/" | |
# - run: touch ./src/main/resources/runwayAccessKey.json | |
# - run: echo $runwayAccessKey.json > ./src/main/resources/runwayAccessKey.json | |
# - run: cat ./src/main/resources/runwayAccessKey.json | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
shell: bash | |
- name: Make zip file | |
run: zip -r ./$GITHUB_SHA.zip . | |
shell: bash | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Upload to S3 | |
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://runway-codedeploy/$GITHUB_SHA.zip | |
- name: Code Deploy | |
run: aws deploy create-deployment --application-name runway-codedeploy --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name githubactions --s3-location bucket=runway-codedeploy,bundleType=zip,key=$GITHUB_SHA.zip |