Skip to content

Update gradle.yml

Update gradle.yml #102

Workflow file for this run

name: familing CI/CD
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
env:
S3_BUCKET_NAME: sursim-img
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
# 사용하는 자바 버전 17
java-version: '17'
distribution: 'temurin'
- run: touch ./familing/src/main/resources/application.yml
- run: echo "${{ secrets.APPLICATION }}" > ./familing/src/main/resources/application.yml
- run: echo "${{ secrets.firebase_service_key}}" > ./familing/src/main/resources/firebase_service_key.json
- run: cat ./familing/src/main/resources/application.yml
# gradlew에 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x ./familing/gradlew
# gradlew 빌드
- name: Build with Gradle
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build -x test
build-root-directory: ./familing
# 압축파일 형태로 전달
- name: Make zip file
run: zip -r ./familing.zip .
shell: bash
# S3 Bucket으로 Copy
- name: Deliver to AWS S3
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: ${{ secrets.AWS_REGION }}
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./familing.zip s3://$S3_BUCKET_NAME/familing.zip
# Deploy
# applicatio-name => aws code deploy application 이름
- name: Deploy
run: |
aws deploy create-deployment \
--application-name familing \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name familing-deploy-group \
--file-exists-behavior OVERWRITE \
--s3-location bucket=sursim-img,bundleType=zip,key=familing.zip \
--region ap-northeast-2