From 474b7ead64b162eb053dd9152d54b2981ba6cd9d Mon Sep 17 00:00:00 2001 From: jaeyeon kim Date: Tue, 15 Mar 2022 23:26:23 +0900 Subject: [PATCH] #25 github action test --- .github/workflows/pullRequest.yml | 6 ++--- .github/workflows/push.yml | 41 ++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pullRequest.yml b/.github/workflows/pullRequest.yml index 1dc4fbb..f68dc49 100644 --- a/.github/workflows/pullRequest.yml +++ b/.github/workflows/pullRequest.yml @@ -1,9 +1,9 @@ name: Spring build gradle on: - push: - branches: - - develop +# push: +# branches: +# - develop pull_request: branches: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2f7c5d2..a5ff13c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,4 +3,43 @@ name: Spring build gradle on: push: branches: -# - develop # 내가 평소에 PR 하기 전 작업하는 branch 에다가 적용 \ No newline at end of file + - develop # 내가 평소에 PR 하기 전 작업하는 branch 에다가 적용 + +env: + S3_BUCKET_NAME: cafein-deploy # bucket name 변수 생성 + PATH: dogvelopers +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + working-directory: ${{ PATH }} + + - name: Build with Gradle + run: ./gradlew clean build + working-directory: ${{ PATH }} + + - name: Make zip file + run: zip -r ./$GITHUB_SHA.zip . + shell: bash + working-directory: ${{ PATH }} + + - 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: ${{ secrets.AWS_REGION }} + + - name: Upload to S3 + run: aws s3 cp --region ap-northeast-2 ./dogvelopers/$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip \ No newline at end of file