From 2f60a145b09a7243cef562ed22a215b204696eb6 Mon Sep 17 00:00:00 2001 From: xuliwenwenwen <74528885+xuliwenwenwen@users.noreply.github.com> Date: Mon, 15 Apr 2024 10:23:46 +0800 Subject: [PATCH] Create main.yml --- .github/workflows/main.yml | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..16be11c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,41 @@ +name: Deploy CI + +on: + workflow_dispatch: + +jobs: + deploy-prod: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + cache-dependency-path: pingcap-jp/yarn.lock + - name: Build + run: | + cd pingcap-jp + yarn install + yarn build:prod + - name: S3 sync + uses: jakejarvis/s3-sync-action@master + env: + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: 'us-west-1' + SOURCE_DIR: 'pingcap-jp/dist' + DEST_DIR: 'dist' + - name: Deploy server + uses: easingthemes/ssh-deploy@main + with: + REMOTE_HOST: ${{ secrets.DEPLOY_HOST }} + REMOTE_USER: ${{ secrets.DEPLOY_USER }} + SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }} + REMOTE_PORT: ${{ secrets.DEPLOY_PORT }} + SOURCE: 'pingcap-jp' + TARGET: ${{ secrets.DEPLOY_PATH }} + EXCLUDE: 'pingcap-jp/node_modules/' + SCRIPT_AFTER: sh ${{ secrets.DEPLOY_PATH }}/refresh.sh +