Skip to content

chore(blog-cms): delete useless code #474

chore(blog-cms): delete useless code

chore(blog-cms): delete useless code #474

name: blog-cms
on:
push:
paths:
- 'apps/blog-cms/**'
branches:
- '**'
pull_request:
paths:
- 'apps/blog-cms/**'
branches:
- '**'
jobs:
test:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install Pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x
- name: Install rush.js globally
run: pnpm add @microsoft/rush --global
- name: Install dependencies
run: rush update --bypass-policy
- name: Create .env.production file
run: |
mkdir -p ./apps/blog-cms
echo "REACT_APP_BEG_SERVICE_DOMAIN=${{ vars.REACT_APP_BEG_SERVICE_DOMAIN }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_UPLOADER_SERVICE_DOMAIN=${{ vars.REACT_APP_UPLOADER_SERVICE_DOMAIN }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_ALGOLIA_APPLICATION_ID=${{ vars.REACT_APP_ALGOLIA_APPLICATION_ID }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_ALGOLIA_ADMIN_API_KEY=${{ vars.REACT_APP_ALGOLIA_ADMIN_API_KEY }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_ALGOLIA_SEARCH_INDEX=${{ vars.REACT_APP_ALGOLIA_SEARCH_INDEX }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_KEY_CLOAK_REALM=${{ vars.REACT_APP_KEY_CLOAK_REALM }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_KEY_CLOAK_URL=${{ vars.REACT_APP_KEY_CLOAK_URL }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_KEY_CLOAK_CLIENT_ID=${{ vars.REACT_APP_KEY_CLOAK_CLIENT_ID }}" >> ./apps/blog-cms/.env.production
- name: Pre compilation
run: rush build -o blog-cms --impacted-by @shared/utils
# テスト成功時はこちらのステップが実行される
- name: Slack Notification on Success at Testing Stage
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Test Success
SLACK_COLOR: good
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'
# テスト失敗時はこちらのステップが実行される
- name: Slack Notification on Failure at Testing Stage
uses: rtCamp/action-slack-notify@v2
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Test Failure
SLACK_COLOR: danger
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'
deployment:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Pnpm
uses: pnpm/action-setup@v2
with:
version: 8.x
- name: Install rush.js globally
run: pnpm add @microsoft/rush --global
- name: Install dependencies
run: rush update --bypass-policy
- name: Create .env.production file
run: |
mkdir -p ./apps/blog-cms
echo "REACT_APP_BEG_SERVICE_DOMAIN=${{ vars.REACT_APP_BEG_SERVICE_DOMAIN }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_UPLOADER_SERVICE_DOMAIN=${{ vars.REACT_APP_UPLOADER_SERVICE_DOMAIN }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_ALGOLIA_APPLICATION_ID=${{ vars.REACT_APP_ALGOLIA_APPLICATION_ID }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_ALGOLIA_ADMIN_API_KEY=${{ vars.REACT_APP_ALGOLIA_ADMIN_API_KEY }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_ALGOLIA_SEARCH_INDEX=${{ vars.REACT_APP_ALGOLIA_SEARCH_INDEX }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_KEY_CLOAK_REALM=${{ vars.REACT_APP_KEY_CLOAK_REALM }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_KEY_CLOAK_URL=${{ vars.REACT_APP_KEY_CLOAK_URL }}" >> ./apps/blog-cms/.env.production
echo "REACT_APP_KEY_CLOAK_CLIENT_ID=${{ vars.REACT_APP_KEY_CLOAK_CLIENT_ID }}" >> ./apps/blog-cms/.env.production
- name: Compilation
run: rush build -o blog-cms --impacted-by @shared/utils
- name: Prepare files for deployment
run: |
mkdir -p build
cp -r apps/blog-cms/build/* build/
- name: Copy file via ssh key
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSH_KEY }}
source: 'build/*'
target: '/var/www/beg-monorepo/apps/blog-cms'
overwrite: true
# テスト成功時はこちらのステップが実行される
- name: Slack Notification on Success at Deployment Stage
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Deploy Success
SLACK_COLOR: good
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'
# テスト失敗時はこちらのステップが実行される
- name: Slack Notification on Failure at Deployment Stage
uses: rtCamp/action-slack-notify@v2
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOKS }}
SLACK_CHANNEL: github-actions
SLACK_TITLE: Deploy Failure
SLACK_COLOR: danger
SLACK_FOOTER: 'Powered by Yancey Inc. and its affiliates.'