Skip to content

Commit

Permalink
chore: dev workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
char-yb committed Jul 3, 2024
1 parent de11220 commit 142424e
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/develop-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Pull Request on Check
on:
push:
branches:
- "chore/#24-elastic-beanstalk-deploy"

env:
DOCKERHUB_IMAGE_NAME: walwal-server

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

# Gradle 빌드
- name: Build with Gradle
id: gradle
uses: gradle/gradle-build-action@v3
with:
arguments: |
build
--scan
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

- name: Docker build
run: |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }} .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }}
- name: Current Time
uses: gerred/[email protected]
id: current-time

- name: Replace string
uses: frabert/[email protected]
id: format-time
with:
pattern: '[:\.]+'
string: "${{ steps.current-time.outputs.time }}"
replace-with: '-'
flags: 'g'

# 슬랙으로 빌드 스캔 결과 전송
- name: Send to slack
uses: slackapi/[email protected]
with:
payload: |
{
"text": "Gradle Build Scan Report of ${{ github.workflow }}: ${{ steps.gradle.outputs.build-scan-url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

# Beanstalk 플러그인을 사용
# 미리 생성해둔 IAM 인증키를 사용
- 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 }}
application_name: "walwal-server"
environment_name: "walwal-server-env"
version_label: "github-action-${{ steps.format-time.outputs.replaced }}"
region: ap-northeast-2
deployment_package: Dockerrun.aws.json
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM azul/zulu-openjdk:17-latest
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
13 changes: 13 additions & 0 deletions Dockerrun.aws.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "olderstonebed/walwal-server:latest",
"Update": "true"
},
"Ports": [
{
"ContainerPort": 8080,
"HostPort": 5000
}
]
}

0 comments on commit 142424e

Please sign in to comment.