Skip to content

HelloGSM prod batch CD workflow #3

HelloGSM prod batch CD workflow

HelloGSM prod batch CD workflow #3

name: HelloGSM prod batch CD workflow
on:
push:
paths:
- "hellogsm-batch/**"
branches: [ "main" ]
workflow_dispatch:
jobs:
CD:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name : Setup Gradls's permission
run : chmod +x gradlew
- name: make yml file
run: touch ./hellogsm-batch/src/main/resources/application-prod.yml
echo "${{ secrets.PROD_BATCH_YML }}" > ./hellogsm-batch/src/main/resources/application-prod.yml
shell: bash
- name: Build with Gradle
run : ./gradlew clean hellogsm-batch:build
- 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: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash
- name: Upload to S3
run: aws s3 cp --region ${{ secrets.AWS_REGION }} ./$GITHUB_SHA.zip s3://${{ secrets.BUCKET_NAME }}/prod/batch/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name hellogsm-prod-codedeploy --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name prod-batch-server --s3-location bucket=${{ secrets.BUCKET_NAME }},bundleType=zip,key=prod/batch/$GITHUB_SHA.zip