Merge pull request #318 from Team-Sopetit/refactor/#316-member-routine #156
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: deploy | |
on: | |
push: | |
branches: [ develop ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: gradle | |
- name: Create application-secret.yml | |
run: | | |
pwd | |
touch src/main/resources/application-secret.yml | |
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> src/main/resources/application-secret.yml | |
cat src/main/resources/application-secret.yml | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ACCESS_KEY_SECRET }} | |
aws-region: ap-northeast-2 | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build with Gradle | |
run: ./gradlew build | |
shell: bash | |
- name: Make zip file | |
run: zip -qq -r ./$GITHUB_SHA.zip . | |
shell: bash | |
- name: Upload to AWS S3 | |
run: | | |
aws deploy push \ | |
--application-name sopetit-codedeploy \ | |
--ignore-hidden-files \ | |
--s3-location s3://${{ secrets.AWS_BUCKET_NAME }}/$GITHUB_SHA.zip \ | |
--source . | |
- name: Code Deploy | |
run: aws deploy create-deployment --application-name sopetit-codedeploy | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name sopetit-group | |
--s3-location bucket=${{ secrets.AWS_BUCKET_NAME }},bundleType=zip,key=$GITHUB_SHA.zip |