Merge pull request #183 from PSR-Co/fix/#182-signup-manager-exception #95
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" ] | |
env: | |
PROJECT_NAME: psr_project | |
BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} | |
CODE_DEPLOY_APP_NAME: ${{ secrets.CODE_DEPLOY_APP_NAME}} | |
DEPLOYMENT_GROUP_NAME: ${{ secrets.DEPLOYMENT_GROUP_NAME}} | |
# AWS_REGION: ${{ secrets.AWS_REGION}} | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Create Firebase json | |
id: create-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: "firebase-service-key.json" | |
json: ${{ secrets.FIREBASE_KEY }} | |
dir: "src/main/resources" | |
- run: touch ./src/main/resources/application-secret.yaml | |
- run: echo "${{ secrets.DB_SECRET }}" > ./src/main/resources/application-secret.yaml | |
- run: cat ./src/main/resources/application-secret.yaml | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build and Test | |
run: ./gradlew build -x test | |
- name: Make zip file | |
run: zip -qq -r ./$GITHUB_SHA.zip . | |
shell: bash | |
- 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_PRIVATE_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION}} | |
- name: Upload to S3 | |
run: aws s3 cp --region ${{ secrets.AWS_REGION}} ./$GITHUB_SHA.zip s3://$BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip | |
- name: Code Deploy To EC2 instance | |
run: aws deploy create-deployment | |
--application-name $CODE_DEPLOY_APP_NAME | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name $DEPLOYMENT_GROUP_NAME | |
--s3-location bucket=$BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip |