diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 6a3ef64f..b74a0511 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -6,17 +6,17 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Use Node.js 16.x + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '18.x' - name: Install Pnpm uses: pnpm/action-setup@v2 with: - version: 6.22.2 + version: 8.12.0 - name: Get pnpm store directory id: pnpm-cache @@ -48,16 +48,65 @@ jobs: files: ./lcov.info,./clover.xml directory: ./coverage/ verbose: true + # テスト成功時はこちらのステップが実行される + - 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: - - name: Deploy to server - uses: appleboy/ssh-action@v0.1.4 + - name: Copy file via ssh key + uses: appleboy/scp-action@v0.1.4 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - script: sh ./leetcode-trip-deploy.sh + port: ${{ secrets.PORT }} + key: ${{ secrets.SSH_KEY }} + source: 'build' + target: /var/www/leetcode-trip + - uses: actions/checkout@v4 + - name: Algoria DocSearch Crawler + uses: darrenjennings/algolia-docsearch-action@master + with: + algolia_application_id: ${{ secrets.ALGORIA_APP_ID }} + algolia_api_key: ${{ secrets.ALGORIA_API_KEY }} + file: './algolia-config.json' + # テスト成功時はこちらのステップが実行される + - 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.'