-
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.
[FEAT] #26 - Edit ci and create cd to dev server workflow
- Loading branch information
Showing
2 changed files
with
70 additions
and
4 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,68 @@ | ||
name: CD Dev | ||
|
||
on: [ pull_request ] | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
env: | ||
S3_BUCKET_NAME: jampick-server | ||
S3_FOLDER_NAME: dev | ||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_DATABASE: jampick | ||
MYSQL_ROOT_PASSWORD: ${{ secrets.MYSQL_ROOT_PASSWORD }} | ||
ports: | ||
- "3306:3306" | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
|
||
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
- name: Make zip file | ||
run: zip -qq -r ./$GITHUB_SHA.zip . | ||
|
||
- 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: Upload to S3 | ||
env: | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
run: aws s3 cp --region $AWS_REGION ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$S3_FOLDER_NAME/$GITHUB_SHA.zip | ||
|
||
- name: Code Deploy | ||
run: aws deploy create-deployment --application-name jampick-app --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name jampick-group --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$S3_FOLDER_NAMEyes/$GITHUB_SHA.zip | ||
|
||
- name: Cleanup Gradle Cache | ||
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. | ||
# Restoring these files from a GitHub Actions cache might cause problems for future builds. | ||
run: | | ||
rm -f ~/.gradle/caches/modules-2/modules-2.lock | ||
rm -f ~/.gradle/caches/modules-2/gc.properties |
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