Skip to content

Commit

Permalink
cicd 1
Browse files Browse the repository at this point in the history
  • Loading branch information
justindevcode committed Jul 2, 2023
1 parent ae3518c commit c4c1dfa
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 30 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/ci.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Update application.yml
run: |
echo "$(cat charrypickapp/src/main/resources/application.yml | sed 's/active: local/active: prod/')" > charrypickapp/src/main/resources/application.yml
- name: Grant execute permission for gradlew
working-directory: charrypickapp
run: chmod +x gradlew

- name: Build with Gradle
working-directory: charrypickapp
run: ./gradlew clean build


- name: Get current time
uses: josStorer/[email protected]
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"

- name: Set artifact
run: echo "artifact=$(ls ./build/libs)" >> $GITHUB_ENV

- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ID }}
application_name: cherry-pick-backend
envirmanet_name: Cherry-pick-backend-env
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
region: ap-northeast-2
deployment_package: ./build/libs/${{env.artifact}}
4 changes: 4 additions & 0 deletions charrypickapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}

jar {
enabled = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public class HealthCheckController {

@GetMapping("/")
public String healthCheck() {
return "The service is up and running";
return "The service is up and running CICD";
}
}

0 comments on commit c4c1dfa

Please sign in to comment.