您当前的位置: 首页 >  git

【03】

暂无认证

  • 3浏览

    0关注

    196博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

github workflows配置

【03】 发布时间:2022-06-13 13:54:19 ,浏览量:3

记录两个常用自动构建配置

.github/workflows/main.yml

部署静态文件
name: Deployement

on:
  push:
    branches:
      - main # 分支

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: node version
        run: node -v

      - name: npm version
        run: npm -v

      - name: Install and Build
        run: |#执行命令
          npm install
          npm run-script build
        env:
          CI: false

      - name: Deploy to GitHub Pages
        uses: JamesIves/github-pages-deploy-action@4.1.3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          git-config-email: socialfi_xyz@gmail.com
          git-config-name: socialfi_xyz
          folder: build#部署文件夹
          branch: gh-pages#部署到分支(不要选当前分支或开发分支,会覆盖)
          clean: false

定时执行node脚本
name: CI
on:
  push:
    branches: [ master ]
  schedule:
    - cron: '*/5 * * * *'#5分钟执行一次
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '15'
      - name: build
        run: npm install && npm run build
      - name: Deploy data
        uses: JamesIves/github-pages-deploy-action@4.1.3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          git-config-email: web03
          git-config-name: web03
          folder: build
          branch: dataset
          clean: true

注意

token: ${{ secrets.GITHUB_TOKEN }}

此处这样写,就无需手动生成Actions secrets啦 注意 定时任务间隔是不准确的

关注
打赏
1657344724
查看更多评论
立即登录/注册

微信扫码登录

0.0469s