Skip to content

Commit

Permalink
Merge pull request #13 from readyvery/revert-12-test
Browse files Browse the repository at this point in the history
Revert "Feat: 재고관리 & 마이페이지 추가"
  • Loading branch information
hhbb0081 authored Nov 17, 2023
2 parents cbbb460 + f38d6fa commit e53b8c6
Show file tree
Hide file tree
Showing 30 changed files with 403 additions and 762 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/main_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Main Server Merge
on:
push:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code. # Repo checkout
uses: actions/checkout@v3

- name: Check Node v # Node v 확인
run: node -v

- name: Install dependencies # 의존 파일 설치
run: npm install

- name: Set .env from secrets
run: |
echo "PORT=${{ secrets.MAIN_PORT }}" > .env
echo "WDS_SOCKET_PORT=0" >> .env
echo "NODE_PATH=src/" >> .env
echo "REACT_APP_API_ROOT=${{ secrets.MAIN_REACT_APP_API_ROOT }}" >> .env
echo "REACT_APP_HOME_URL=${{ secrets.MAIN_REACT_APP_HOME_URL }}" >> .env
- name: cat env file
run: cat .env

- name: Generate build # React Build
run: npm run build

- name: file copy
uses: actions/upload-artifact@v3
with:
name: build
path: build
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: file download
uses: actions/download-artifact@v3
with:
name: build
path: build
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_MAIN_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_MAIN_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ap-northeast-2
BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
run: |
aws s3 sync build s3://$BUCKET_NAME/ --delete \
--exact-timestamps
# - name: Cloufront cache invalidation
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.CF_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }}
# AWS_DEFAULT_REGION: us-east-1
# DISTRIBUTION_ID: ${{ secrets.CF_DISTRIBUTION_ID }}
# run: |
# aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*"
- name: Discordbot alert # 디스코드 알림
uses: sarisia/[email protected]
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
content: ${{ (github.actor == 'marinesnow34' && '<@392607023495118862>') ||
(github.actor == '1223v' && '<@368775981667844098>') ||
(github.actor == 'imi21123' && '<@999337351799128115>') ||
(github.actor == 'marina-yhm' && '<@946431150614794240>') ||
(github.actor == 'hhhhyelim' && '<@1076887091427946496>') }}
if: always()
91 changes: 91 additions & 0 deletions .github/workflows/main_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Main Server Pull-request

on:
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check branch
run: |
echo "Head branch is: ${{ github.head_ref }}"
echo "Base branch is: ${{ github.base_ref }}"
if [[ "${{ github.head_ref }}" != "test" ]]; then
echo "test 브랜치가 아님"
exit 1
fi
- name: Checkout source code. # Repo checkout
uses: actions/checkout@v3

- name: Check Node v # Node v 확인
run: node -v

- name: Install dependencies # 의존 파일 설치
run: npm install

- name: Set .env from secrets
run: |
echo "PORT=${{ secrets.MAIN_PORT }}" > .env
echo "WDS_SOCKET_PORT=0" >> .env
echo "NODE_PATH=src/" >> .env
echo "REACT_APP_API_ROOT=${{ secrets.MAIN_REACT_APP_API_ROOT }}" >> .env
echo "REACT_APP_HOME_URL=${{ secrets.MAIN_REACT_APP_HOME_URL }}" >> .env
- name: cat env file
run: cat .env

- name: Generate build # React Build
run: npm run build
- name: Discordbot alert # 디스코드 알림
uses: sarisia/[email protected]
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
content: ${{ (github.actor == 'marinesnow34' && '<@392607023495118862>') ||
(github.actor == '1223v' && '<@368775981667844098>') ||
(github.actor == 'imi21123' && '<@999337351799128115>') ||
(github.actor == 'marina-yhm' && '<@946431150614794240>') ||
(github.actor == 'hhhhyelim' && '<@1076887091427946496>') }}
if: always()

after:
runs-on: ubuntu-latest
needs: build
if: always()
permissions:
contents: read
pull-requests: write
steps:
- name: Comment on failure and close PR
if: needs.build.result == 'failure'
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '빌드 실패'
});
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
state: 'closed'
});
- name: Auto approve pull request
if: needs.build.result == 'success'
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
});
80 changes: 80 additions & 0 deletions .github/workflows/test_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Test Server Merge
on:
push:
branches: [ "test" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code. # Repo checkout
uses: actions/checkout@v3

- name: Check Node v # Node v 확인
run: node -v

- name: Install dependencies # 의존 파일 설치
run: npm install

- name: Set .env from secrets
run: |
echo "PORT=${{ secrets.TEST_PORT }}" > .env
echo "WDS_SOCKET_PORT=0" >> .env
echo "NODE_PATH=src/" >> .env
echo "REACT_APP_API_ROOT=${{ secrets.TEST_REACT_APP_API_ROOT }}" >> .env
echo "REACT_APP_HOME_URL=${{ secrets.TEST_REACT_APP_HOME_URL }}" >> .env
- name: cat env file
run: cat .env

- name: Generate build # React Build
run: npm run build

- name: file copy
uses: actions/upload-artifact@v3
with:
name: build
path: build
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: file download
uses: actions/download-artifact@v3
with:
name: build
path: build
- name: Upload to Cloudflare
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CF_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CF_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
BUCKET_NAME: ${{ secrets.CF_BUCKET_NAME }}
ENDPOINT_URL: ${{ secrets.CF_ENDPOINT_URL }}
run: |
aws s3 sync build s3://$BUCKET_NAME/build_ceo \
--endpoint-url $ENDPOINT_URL --delete \
--exact-timestamps
- name: SSH and deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.PORT }}
timeout: 40s # 30초 기본
script: |
aws s3 sync s3://readyvery-dev-server/build_ceo ./docker/react/build_boss \
--endpoint-url https://29c6e4b55b1ddb8d2b6e69df21141caa.r2.cloudflarestorage.com --delete \
--exact-timestamps
- name: Discordbot alert # 디스코드 알림
uses: sarisia/[email protected]
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
content: ${{ (github.actor == 'marinesnow34' && '<@392607023495118862>') ||
(github.actor == '1223v' && '<@368775981667844098>') ||
(github.actor == 'imi21123' && '<@999337351799128115>') ||
(github.actor == 'marina-yhm' && '<@946431150614794240>') ||
(github.actor == 'hhhhyelim' && '<@1076887091427946496>') }}
if: always()
83 changes: 83 additions & 0 deletions .github/workflows/test_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Test Server Pull-request # Workflow 이름

on:
pull_request:
branches: [ "test" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout source code. # Repo checkout
uses: actions/checkout@v3

- name: Check Node v # Node v 확인
run: node -v

- name: Install dependencies # 의존 파일 설치
run: npm install

- name: Set .env from secrets
run: |
echo "PORT=${{ secrets.TEST_PORT }}" > .env
echo "WDS_SOCKET_PORT=0" >> .env
echo "NODE_PATH=src/" >> .env
echo "REACT_APP_API_ROOT=${{ secrets.TEST_REACT_APP_API_ROOT }}" >> .env
echo "REACT_APP_HOME_URL=${{ secrets.TEST_REACT_APP_HOME_URL }}" >> .env
- name: cat env file
run: cat .env

- name: Generate build # React Build
run: npm run build
- name: Discordbot alert # 디스코드 알림
uses: sarisia/[email protected]
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
content: ${{ (github.actor == 'marinesnow34' && '<@392607023495118862>') ||
(github.actor == '1223v' && '<@368775981667844098>') ||
(github.actor == 'imi21123' && '<@999337351799128115>') ||
(github.actor == 'marina-yhm' && '<@946431150614794240>') ||
(github.actor == 'hhhhyelim' && '<@1076887091427946496>') }}
if: always()

after:
runs-on: ubuntu-latest
needs: build
if: always()
permissions:
contents: read
pull-requests: write
steps:
- name: Comment on failure and close PR
if: needs.build.result == 'failure'
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '빌드 실패'
});
github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
state: 'closed'
});
- name: Auto approve pull request
if: needs.build.result == 'success'
uses: actions/github-script@v6
with:
github-token: ${{ github.token }}
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
});
Loading

0 comments on commit e53b8c6

Please sign in to comment.