-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from yudonggeun/chore/deploy_commands
[CI/CD] 원할한 배포를 위한 Github Actions Workflow 수정 및 변경
- Loading branch information
Showing
4 changed files
with
256 additions
and
23 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,82 @@ | ||
name: Auth micro service CI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' | ||
default: 'latest' | ||
|
||
jobs: | ||
build: | ||
if: github.event.inputs.version == 'latest' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: set up jdk 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '21' | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: make api documents | ||
run: ./gradlew --info auth:openapi3 | ||
|
||
- name: configure openapi3 spec | ||
run: | | ||
yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./auth/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./auth/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./auth/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.security[0].bearerAuth = []' ./auth/src/main/resources/static/openapi3.yaml | ||
- name: push image using jib | ||
run: ./gradlew --info auth:jib | ||
|
||
tagging: | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- if: github.event.inputs.version != 'latest' | ||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: set image tag | ||
run: | | ||
echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV | ||
- name: checkout infra repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kSideProject/kpring-infra | ||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
ref: main | ||
|
||
- name: edit infra repository image tag | ||
run: | | ||
echo 'env(IMAGE_TAG)' | ||
yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/auth/values.yaml | ||
- name: commit | ||
uses: leigholiver/[email protected] | ||
with: | ||
source: . | ||
destination_repo: kSideProject/kpring-infra | ||
deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
commit_message: 'ci: update auth image version=${{ github.event.inputs.version }}' |
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,70 @@ | ||
name: Frontend Nginx micro service CI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' | ||
default: 'latest' | ||
|
||
jobs: | ||
build: | ||
if: github.event.inputs.version == 'latest' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# Build Docker image | ||
- name: Build Docker Image | ||
run: | | ||
docker build -t kpring/front_app:$(git rev-parse --short=8 HEAD) . | ||
# Push Docker image to DockerHub | ||
- name: Push Docker Image to DockerHub | ||
run: | | ||
docker push kpring/front_app:$(git rev-parse --short=8 HEAD) | ||
tagging: | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- if: github.event.inputs.version != 'latest' | ||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: set image tag | ||
run: | | ||
echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV | ||
- name: checkout infra repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kSideProject/kpring-infra | ||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
ref: main | ||
|
||
- name: edit infra repository image tag | ||
run: | | ||
echo 'env(IMAGE_TAG)' | ||
yq eval -i '.image.tag = env(IMAGE_TAG)' ./charts/front/values.yaml | ||
- name: commit | ||
uses: leigholiver/[email protected] | ||
with: | ||
source: . | ||
destination_repo: kSideProject/kpring-infra | ||
deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
commit_message: 'ci: update frontend image version=${{ github.event.inputs.version }}' |
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 |
---|---|---|
@@ -1,52 +1,49 @@ | ||
name: CI | ||
name: Server micro service CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] # push 되었을 때, 실행 | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' | ||
default: 'latest' | ||
|
||
jobs: | ||
build: | ||
if: github.event.inputs.version == 'latest' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: set up jdk 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '21' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: make api documents | ||
run: ./gradlew --info openapi3 | ||
run: ./gradlew --info server:openapi3 | ||
|
||
- name: configure openapi3 spec | ||
run: | | ||
yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./server/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./server/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./server/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.security[0].bearerAuth = []' ./server/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./user/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./user/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./user/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.security[0].bearerAuth = []' ./user/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./auth/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./auth/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./auth/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.security[0].bearerAuth = []' ./auth/src/main/resources/static/openapi3.yaml | ||
- name: push image using jib | ||
run: ./gradlew --info jib | ||
run: ./gradlew --info server:jib | ||
|
||
tagging: | ||
needs: | ||
|
@@ -56,7 +53,11 @@ jobs: | |
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: set tag | ||
- if: github.event.inputs.version != 'latest' | ||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: set image tag | ||
run: | | ||
echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV | ||
|
@@ -67,17 +68,15 @@ jobs: | |
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
ref: main | ||
|
||
- name: edit infra repository tag | ||
- name: edit infra repository image tag | ||
run: | | ||
echo 'env(IMAGE_TAG)' | ||
yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/server/values.yaml | ||
yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/user/values.yaml | ||
yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/auth/values.yaml | ||
- name: commit | ||
uses: leigholiver/[email protected] | ||
with: | ||
source: . | ||
destination_repo: kSideProject/kpring-infra | ||
deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
commit_message: 'ci: update tag to env(IMAGE_TAG)' | ||
commit_message: 'ci: update server image version=${{ github.event.inputs.version }}' |
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,82 @@ | ||
name: User micro service CI | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: '배포하고자 하는 버전을 입력해주세요. 최신 버전이라면 생략해주세요. (git commit id 앞 8자리)' | ||
default: 'latest' | ||
|
||
jobs: | ||
build: | ||
if: github.event.inputs.version == 'latest' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: set up jdk 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '21' | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: make api documents | ||
run: ./gradlew --info user:openapi3 | ||
|
||
- name: configure openapi3 spec | ||
run: | | ||
yq eval -i '.components.securitySchemes.bearerAuth.type = "http"' ./user/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.scheme = "bearer"' ./user/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.components.securitySchemes.bearerAuth.bearerFormat = "JWT"' ./user/src/main/resources/static/openapi3.yaml | ||
yq eval -i '.security[0].bearerAuth = []' ./user/src/main/resources/static/openapi3.yaml | ||
- name: push image using jib | ||
run: ./gradlew --info user:jib | ||
|
||
tagging: | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- if: github.event.inputs.version != 'latest' | ||
name: checkout | ||
run: git checkout ${{ github.event.inputs.version }} | ||
|
||
- name: set image tag | ||
run: | | ||
echo "IMAGE_TAG=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV | ||
- name: checkout infra repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kSideProject/kpring-infra | ||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
ref: main | ||
|
||
- name: edit infra repository image tag | ||
run: | | ||
echo 'env(IMAGE_TAG)' | ||
yq eval -i '.service.tag = env(IMAGE_TAG)' ./charts/user/values.yaml | ||
- name: commit | ||
uses: leigholiver/[email protected] | ||
with: | ||
source: . | ||
destination_repo: kSideProject/kpring-infra | ||
deploy_key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
commit_message: 'ci: update user image version=${{ github.event.inputs.version }}' |