Merge pull request #258 from Team-Sopetit/develop #10
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: [ main ] | |
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_PROD }} | |
aws-secret-access-key: ${{ secrets.ACCESS_KEY_SECRET_PROD }} | |
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 softie-code-deploy \ | |
--ignore-hidden-files \ | |
--s3-location s3://${{ secrets.AWS_BUCKET_NAME_PROD }}/$GITHUB_SHA.zip \ | |
--source . | |
- name: Code Deploy | |
run: aws deploy create-deployment --application-name softie-code-deploy | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name prod-group | |
--s3-location bucket=${{ secrets.AWS_BUCKET_NAME_PROD }},bundleType=zip,key=$GITHUB_SHA.zip |