Merge pull request #4 from github-learning/dev-11 #6
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: Build and Deploy | |
on: # 监听 main 分支上的 push 事件 | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest # 构建环境使用 ubuntu | |
steps: | |
# 下载源码 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# 设置 Node.js 环境 | |
- name: Set up Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: '20.x' | |
# 安装依赖 | |
- name: Install dependencies | |
run: npm install | |
# 打包项目 | |
- name: Build project | |
run: npm run build | |
- name: Verify build output | |
run: cat dist/index.html | |
- name: Deploy # 将打包内容发布到 github page | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
branch: gh-pages | |
publish_dir: ./dist | |
github_token: ${{ secrets.VUE3_ADMIN_SERVER }} # secert 名 | |
user_name: ${{ secrets.MY_USER_NAME }} # 通过 Secrets 配置 | |
user_email: ${{ secrets.MY_USER_EMAIL }} # 通过 Secrets 配置 | |
commit_message: 自动部署 | |
# - name: Disable Jekyll | |
# run: echo '' > ./dist/.nojekyll | |
# ·-name:·发布到阿里云 | |
# uses:easingthemes/ssh-deployav2.1.1 | |
# env: | |
# ·#私钥 | |
# SSH_PRIVATE_KEY:${{secrets.PRIVATE_KEY} | |
# #:scp参数 | |
# ARGS:'-avzr.--delete' | |
# #·源目录 | |
# SOURCE:·'dist' | |
# #~服务器ip:换成你的服务器IP | |
# REMOTE_HOST:${{secrets.REMOTE_HOST-} | |
# #用户 | |
# REMOTE USER:·'root' | |
# #目标地址 | |
# -TARGET:-'/wwww/wwwroot' | |
# 333 |