Skip to content

Commit

Permalink
ci: copy file via ssh key
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Dec 10, 2023
1 parent 6bb3f87 commit 2989c25
Showing 1 changed file with 57 additions and 8 deletions.
65 changes: 57 additions & 8 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.'

0 comments on commit 2989c25

Please sign in to comment.