57 lines
1.8 KiB
YAML
57 lines
1.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
build:
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '.md')" # 如果 commit 信息包含以下关键字则跳过该任务
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Sync to Gitee
|
|
uses: x-dr/sync-repo-to-gitee@master
|
|
env:
|
|
# 在 Settings->Secrets 配置 GITEE_KEY
|
|
SSH_KEY: ${{ secrets.GITEE_KEY }}
|
|
with:
|
|
# 注意替换为你的 GitHub 源仓库地址
|
|
github-repo: "git@github.com:xiaohai2271/blog-frontEnd.git"
|
|
# 注意替换为你的 Gitee 目标仓库地址
|
|
gitee-repo: "git@gitee.com:xiaohai2271/blog-frontEnd.git"
|
|
|
|
- name: Use Node.js 16.x
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: '16.x'
|
|
- run: npm install
|
|
- run: npm run lint && npm run build:prod
|
|
- run: cd dist/index/ && tar -cf index.tar ./* && mv index.tar ../../
|
|
|
|
- name: Upload a Build Artifact
|
|
uses: actions/upload-artifact@v2.1.4
|
|
with:
|
|
name: dist
|
|
path: ./dist/index/*
|
|
|
|
# - name: SCP
|
|
# uses: appleboy/scp-action@master
|
|
# with:
|
|
# host: ${{ secrets.SSH_HOST }}
|
|
# username: ${{ secrets.SSH_USERNAME }}
|
|
# password: ${{ secrets.SSH_PASSWORD }}
|
|
# port: ${{ secrets.SSH_PORT }}
|
|
# source: "index.tar"
|
|
# target: "/www/wwwroot/www.celess.cn"
|
|
|
|
# - name: Run SSH command
|
|
# uses: garygrossgarten/github-action-ssh@v0.5.0
|
|
# with:
|
|
# command: cd /www/wwwroot/www.celess.cn && bash deploy.sh
|
|
# host: ${{ secrets.SSH_HOST }}
|
|
# username: ${{ secrets.SSH_USERNAME }}
|
|
# password: ${{ secrets.SSH_PASSWORD }}
|
|
# port: ${{ secrets.SSH_PORT }}
|