add article #45
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Node.js CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: write | |
#env: | |
# SERVER_PRIVATE_KEY: ${{ secrets.SERVER_PRIVATE_KEY }} # 服务器私钥 | |
# SERVER_HOST: ${{ secrets.SERVER_HOST }} # 服务器IP地址 | |
# USER_NAME: ${{ secrets.USER_NAME }} # 服务器用户名 | |
# SERVER_PORT: ${{ secrets.SERVER_PORT }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install and Build | |
run: | | |
npm install | |
npm run buildLinux | |
# 不会新建文件夹 | |
# - name: Deploy to GitHub Pages | |
# uses: JamesIves/github-pages-deploy-action@v4 | |
# with: | |
# token: ${{ secrets.ACCESS_TOKEN }} # 使用刚新建的secret | |
# branch: build # 存放产物的分支名称 | |
# folder: dist # 存放build后产物的目录 | |
# 改用新的打包,会新建一个文件夹 publish_dir | |
# https://github.com/peaceiris/actions-gh-pages | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
# If you're changing the branch from main, | |
# also change the `main` in `refs/heads/main` | |
# below accordingly. | |
with: | |
github_token: ${{ secrets.ACCESS_TOKEN }} | |
publish_dir: dist | |
publish_branch: build | |
destination_dir: dist | |
# https://github:com/easingthemes/ssh-deploy | |
# | |
# - name: Deploy to Server | |
# uses: easingthemes/ssh-deploy@main | |
# env: | |
# SSH_PRIVATE_KEY: ${{ secrets.SERVER_PRIVATE_KEY }} | |
# ARGS: "-rltgoDzvO --delete" | |
# SOURCE: "dist/" | |
# REMOTE_HOST: ${{ secrets.SERVER_HOST }} | |
# REMOTE_PORT: ${{ secrets.SERVER_PORT }} | |
# REMOTE_USER: ${{ secrets.USER_NAME }} | |
# TARGET: "/var/www/web/helloCoder-Java/" | |
# EXCLUDE: "/dist/, /node_modules/" |