-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
S3_BUCKET_NAME: commonplantbucket | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
|
||
- name: Copy yml | ||
env: | ||
OCCUPY_SECRET: ${{ secrets.OCCUPY_SECRET }} | ||
OCCUPY_SECRET_DIR: src/main/resources | ||
OCCUPY_SECRET_DIR_FILE_NAME: application.yml | ||
run: echo $OCCUPY_SECRET | base64 --decode > $OCCUPY_SECRET_DIR/$OCCUPY_SECRET_DIR_FILE_NAME | ||
|
||
- name: Copy FCM Secret | ||
env: | ||
FCM_SECRET: ${{ secrets.FCM_SECRET }} | ||
FCM_SECRET_DIR: src/main/resources/firebase | ||
FCM_DIR_FILE_NAME: serviceAccountKey.json | ||
run: echo $FCM_SECRET | base64 --decode > $FCM_SECRET_DIR/$FCM_DIR_FILE_NAME | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew clean build | ||
|
||
- name: Make Directory | ||
run: mkdir -p deploy | ||
|
||
- name: Copy Jar | ||
run: cp ./build/libs/commonplant.jar ./deploy | ||
|
||
- name: Copy appspec.yml | ||
run: cp appspec.yml ./deploy | ||
|
||
- name: Copy script | ||
run: cp ./scripts/*.sh ./deploy | ||
|
||
- name: Make zip file | ||
run: zip -r -qq -j ./common.zip ./deploy | ||
shell: bash | ||
|
||
- name: AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Upload to S3 | ||
run: aws s3 cp --region ap-northeast-2 ./common.zip s3://$S3_BUCKET_NAME/ | ||
|
||
- name: Code Deploy | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
run: aws deploy create-deployment --application-name logging-system-deploy --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name develop --file-exists-behavior OVERWRITE --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=common.zip --region ap-northeast-2 |