-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
498 additions
and
5 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,23 @@ | ||
name: "slack-notify" | ||
|
||
inputs: | ||
status: | ||
required: false | ||
default: "failure" | ||
slack_incoming_url: | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- name: Send slack | ||
shell: bash | ||
run: | | ||
if [ "${{ inputs.status }}" = "success" ]; then | ||
EMOTICON="✅" | ||
else | ||
EMOTICON="⛔" | ||
fi | ||
MSG="{ \"text\":\">${EMOTICON} workflow (<https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}|${GITHUB_WORKFLOW}>) in <https://github.com/${GITHUB_REPOSITORY}|${GITHUB_REPOSITORY}>\n><https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}/checks|${GITHUB_JOB}> job ${{ inputs.status }}, branch=\`${GITHUB_REF#refs/heads/}\`\"}" | ||
curl -X POST -H 'Content-type: application/json' --data "${MSG}" "${{ inputs.slack_incoming_url }}" |
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,95 @@ | ||
name: release-client CI/CD | ||
on: | ||
push: | ||
branches: | ||
- 42-env-docker-및-remote-server-설정 | ||
paths: | ||
- "client/**" | ||
|
||
jobs: | ||
build-image: | ||
name: release-client CI/CD | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Node 설정 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: node_modules 폴더 캐싱 | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: "**/client/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/client/yarn.lock') }} | ||
|
||
- name: node_modules 폴더 캐시가 없다면 dependencies 설치 | ||
working-directory: "./client" | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
|
||
- name: Client 소스 빌드 | ||
working-directory: "./client" | ||
run: yarn build | ||
|
||
- name: GitHub Container Registry 로그인 | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: kumsil1006 | ||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
|
||
- name: Github Release 최신 tag 받아오기 | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker images build 및 GitHub Container Registry로 push | ||
uses: docker/[email protected] | ||
with: | ||
push: true | ||
tags: ghcr.io/kumsil1006/oao-client:${{ steps.tag_version.outputs.previous_tag }},ghcr.io/kumsil1006/oao-client:latest | ||
context: ./client | ||
|
||
- name: Docker Compose 파일 운영 서버로 복사 | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.ANOTHER_HOST }} | ||
username: ${{ secrets.ANOTHER_USERNAME }} | ||
password: ${{ secrets.ANOTHER_PASSWORD }} | ||
port: ${{ secrets.ANOTHER_PORT }} | ||
source: "docker-compose.yml" | ||
target: "oao" | ||
|
||
- name: 운영 서버에서 Docker Compose 실행 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.ANOTHER_HOST }} | ||
username: ${{ secrets.ANOTHER_USERNAME }} | ||
password: ${{ secrets.ANOTHER_PASSWORD }} | ||
port: ${{ secrets.ANOTHER_PORT }} | ||
script: | | ||
echo ${{secrets.CONTAINER_REGISTRY_TOKEN}} | docker login ghcr.io -u kumsil1006 --password-stdin | ||
docker pull ghcr.io/kumsil1006/oao-client | ||
docker pull ghcr.io/kumsil1006/oao-proxy | ||
cd oao | ||
docker-compose up -d | ||
docker image prune | ||
- name: 실패시 슬랙 메시지 전송 | ||
if: ${{ failure() }} | ||
uses: ./.github/actions/slack-notify | ||
with: | ||
slack_incoming_url: ${{ secrets.SLACK_INCOMING_URL }} | ||
|
||
- name: 성공시 슬랙 메시지 전송 | ||
if: ${{ success() }} | ||
uses: ./.github/actions/slack-notify | ||
with: | ||
status: success | ||
slack_incoming_url: ${{ secrets.SLACK_INCOMING_URL }} |
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,89 @@ | ||
name: dev-client CI/CD | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "client/**" | ||
|
||
jobs: | ||
build-image: | ||
name: dev-client CI/CD | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Node 설정 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: node_modules 폴더 캐싱 | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: "**/client/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/client/yarn.lock') }} | ||
|
||
- name: node_modules 폴더 캐시가 없다면 dependencies 설치 | ||
working-directory: "./client" | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: yarn | ||
|
||
- name: Client 소스 build | ||
working-directory: "./client" | ||
run: yarn build | ||
|
||
- name: GitHub Container Registry 로그인 | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: kumsil1006 | ||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
|
||
- name: Docker images build 및 GitHub Container Registry로 push | ||
uses: docker/[email protected] | ||
with: | ||
push: true | ||
tags: ghcr.io/kumsil1006/oao-dev-client | ||
context: ./client | ||
|
||
- name: Docker Compose 파일 운영 서버로 복사 | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.ANOTHER_HOST }} | ||
username: ${{ secrets.ANOTHER_USERNAME }} | ||
password: ${{ secrets.ANOTHER_PASSWORD }} | ||
port: ${{ secrets.ANOTHER_PORT }} | ||
source: "docker-compose.yml" | ||
target: "oao" | ||
|
||
- name: 운영 서버에서 Docker Compose 실행 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.ANOTHER_HOST }} | ||
username: ${{ secrets.ANOTHER_USERNAME }} | ||
password: ${{ secrets.ANOTHER_PASSWORD }} | ||
port: ${{ secrets.ANOTHER_PORT }} | ||
script: | | ||
echo ${{secrets.CONTAINER_REGISTRY_TOKEN}} | docker login ghcr.io -u kumsil1006 --password-stdin | ||
docker pull ghcr.io/kumsil1006/oao-dev-client | ||
docker pull ghcr.io/kumsil1006/oao-dev-proxy | ||
cd oao | ||
docker-compose up -d | ||
docker image prune | ||
- name: 실패시 슬랙 메시지 전송 | ||
if: ${{ failure() }} | ||
uses: ./.github/actions/slack-notify | ||
with: | ||
slack_incoming_url: ${{ secrets.SLACK_INCOMING_URL }} | ||
|
||
- name: 성공시 슬랙 메시지 전송 | ||
if: ${{ success() }} | ||
uses: ./.github/actions/slack-notify | ||
with: | ||
status: success | ||
slack_incoming_url: ${{ secrets.SLACK_INCOMING_URL }} |
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,22 @@ | ||
name: Release Github Application Version | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release-application: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Github Release 최신 tag 받아오기 | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: GitHub project release 업데이트 | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} |
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,87 @@ | ||
name: release-server CI/CD | ||
on: | ||
push: | ||
branches: | ||
- release | ||
paths: | ||
- "server/**" | ||
|
||
jobs: | ||
build-image: | ||
name: release-server CI/CD | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Node 설정 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "18.x" | ||
|
||
- name: Typescript 파일들 compile | ||
working-directory: "./server" | ||
env: | ||
CI: "" | ||
run: | | ||
yarn install --immutable --immutable-cache --check-cache | ||
yarn build | ||
- name: GitHub Container Registry 로그인 | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: kumsil1006 | ||
password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
|
||
- name: Github Release 최신 tag 받아오기 | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker images build 및 GitHub Container Registry로 push | ||
uses: docker/[email protected] | ||
with: | ||
context: ./server | ||
push: true | ||
tags: ghcr.io/kumsil1006/oao-server:${{ steps.tag_version.outputs.previous_tag }},ghcr.io/kumsil1006/oao-server:latest | ||
|
||
- name: Docker Compose 파일 운영 서버로 복사 | ||
uses: appleboy/scp-action@master | ||
with: | ||
host: ${{ secrets.ANOTHER_HOST }} | ||
username: ${{ secrets.ANOTHER_USERNAME }} | ||
password: ${{ secrets.ANOTHER_PASSWORD }} | ||
port: ${{ secrets.ANOTHER_PORT }} | ||
source: "docker-compose.yml" | ||
target: "oao" | ||
|
||
- name: 운영 서버에서 Docker Compose 실행 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.ANOTHER_HOST }} | ||
username: ${{ secrets.ANOTHER_USERNAME }} | ||
password: ${{ secrets.ANOTHER_PASSWORD }} | ||
port: ${{ secrets.ANOTHER_PORT }} | ||
script: | | ||
echo ${{secrets.CONTAINER_REGISTRY_TOKEN}} | docker login ghcr.io -u kumsil1006 --password-stdin | ||
docker pull ghcr.io/kumsil1006/oao-server | ||
docker pull ghcr.io/kumsil1006/oao-proxy | ||
cd oao | ||
docker-compose up -d | ||
docker image prune | ||
- name: 실패시 슬랙 메시지 전송 | ||
if: ${{ failure() }} | ||
uses: ./.github/actions/slack-notify | ||
with: | ||
slack_incoming_url: ${{ secrets.SLACK_INCOMING_URL }} | ||
|
||
- name: 성공시 슬랙 메시지 전송 | ||
if: ${{ success() }} | ||
uses: ./.github/actions/slack-notify | ||
with: | ||
status: success | ||
slack_incoming_url: ${{ secrets.SLACK_INCOMING_URL }} |
Oops, something went wrong.