Merge pull request #122 from NJUPT-SAST/dev-zza #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CICD | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: Install dependencies with pnpm | |
run: pnpm install | |
- name: Run build task | |
env: | |
CI: false | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
GENERATE_SOURCEMAP: false | |
run: pnpm build | |
- name: Generating tarball | |
run: cd build && tar -czf ../artifact.tar.gz . | |
- name: Deploy to Server | |
uses: easingthemes/[email protected] | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_KEY }} | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
SOURCE: artifact.tar.gz | |
TARGET: /www/temp | |
SCRIPT_AFTER: | | |
cd /www/temp | |
tar -xf artifact.tar.gz | |
rm artifact.tar.gz | |
cd ../ | |
rm -rf ./approve.sast.fun.backup/* | |
mv ./approve.sast.fun/* ./approve.sast.fun.backup/ | |
mv ./temp/* ./approve.sast.fun/ |