Skip to content

Commit

Permalink
[chore][#17]github action CI/CD workflow 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
sejoon00 committed Jul 25, 2024
1 parent 56ce873 commit 4231d67
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 50 deletions.
54 changes: 15 additions & 39 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name: Gradle Package

on:
pull_request:
branches: ["master"]
branches: [ "main" ]

jobs:
build:
Expand All @@ -20,43 +20,19 @@ jobs:
packages: write

steps:
- name: checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: create application-aws.yml
run:
mkdir ./src/main/resources
cd ./src/main/resources

touch ./application-aws.yml

echo "${{ secrets.YML-AWS }}" >> ./application-aws.yml

cat ./application-aws.yml


- name: build
run: |
chmod +x gradlew
./gradlew build -x test
- name: Docker hub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_ID }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}


- name: Docker image build
run: |
docker build -t ${{secrets.DOCKERHUB_ID}}/Cheada-spring .
- name: checkout
uses: actions/checkout@v3

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'


- name: Docker Hub push
run: docker push ${{secrets.DOCKERHUB_ID}}/Cheada-spring
- name: build
run: |
chmod +x gradlew
./gradlew build -x test
./gradlew openapi3
20 changes: 10 additions & 10 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: deploy-spring-server
name: deploy-bbogak-dev-server
on:
push:
branches: master
branches: main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy spring MainServer(master)
- name: Deploy spring MainServer(main)
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
script: |
cd ~/Desktop/ChaeDa_spring
git fetch origin master
git merge origin/master
cd ~/bbo-gak-server
git fetch origin main
git merge origin/main
./gradlew build
docker rm desktop_back_1 --force
docker rmi desktop_back
cd ..
docker-compose up -d
./gradlew openapi3
docker rm bbo-gak-server_back_1 --force
docker rmi bbo-gak-server_back
docker-compose -f docker-compose-dev.yml up --build -d
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ dependencies {
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// JWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
Expand Down

0 comments on commit 4231d67

Please sign in to comment.