Skip to content

Merge pull request #253 from Team-Sopetit/develop #5

Merge pull request #253 from Team-Sopetit/develop

Merge pull request #253 from Team-Sopetit/develop #5

Workflow file for this run

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