feat: add #1
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: DeployALi | |
# 在main分支发生push事件/pull_request时触发。 | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
# 设置环境变量 | |
TARGET_DIR: /www/web/next | |
jobs: | |
# 打包构建 | |
depoly: | |
runs-on: ubuntu-latest # 运行在虚拟机环境ubuntu-latest | |
steps: | |
- name: Checkout # 步骤1 | |
uses: actions/checkout@v1 # 使用的动作。格式:userName/repoName。作用:检出仓库,获取源码。 官方actions库:https://github.com/actions | |
- run: npm install | |
- name: Build | |
run: npm run build | |
- name: Deploy Server | |
uses: cross-the-world/ssh-scp-ssh-pipelines@latest | |
env: | |
WELCOME: "ssh scp ssh pipelines CPP server" | |
LASTSSH: "after copying" | |
with: | |
host: "47.101.50.136" | |
user: "root" | |
pass: ${{ secrets.ALI_PASSWORD }} | |
connect_timeout: 20s | |
first_ssh: |- | |
rm -rf $TARGET_DIR | |
echo $WELCOME | |
mkdir -p $TARGET_DIR | |
scp: |- | |
'./out/*' => $TARGET_DIR/ | |
last_ssh: |- # --build 每一次都需要重新打镜像 | |
cd $TARGET_DIR | |
echo $LASTSSH |