Merge pull request #191 from Central-MakeUs/develop #11
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: packy API Prod Server - CD | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
CD: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ACTION_TOKEN }} | |
submodules: true | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v3 | |
- name: Build with Gradle & Upload Image to ECR | |
run: ./gradlew -Pprod clean jib | |
- name: Get current time | |
uses: josStorer/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYYMMDD_HH-mm-ss | |
utcOffset: "+09:00" | |
- name: Generate deployment package | |
run: | | |
mkdir -p deploy/.platform/nginx/conf.d | |
cp Dockerrun.aws.prod.json deploy/Dockerrun.aws.json | |
cp -r .ebextensions-prod deploy/.ebextensions | |
cp .platform/nginx/conf.d/proxy-prod.conf deploy/.platform/nginx/conf.d/proxy.conf | |
cd deploy && zip -r deploy.zip . | |
- name: Beanstalk Deploy | |
uses: einaregilsson/beanstalk-deploy@v21 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: packy-prod-beanstalk | |
environment_name: Packy-prod-beanstalk-env | |
version_label: packy-prod-${{steps.current-time.outputs.formattedTime}} | |
region: ${{ secrets.AWS_REGION }} | |
deployment_package: deploy/deploy.zip | |
wait_for_environment_recovery: 200 | |
# - name: Update Release | |
# uses: release-drafter/release-drafter@v5 | |
# with: | |
# config-name: release-drafter-config.yml | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }} |