GitHub Actions 构建器
可视化构建 GitHub Actions 工作流。配置触发器、添加作业和步骤,然后复制生成的 YAML。
Steps:
1.Checkout codeactions/checkout@v4
2.Setup Node.jsactions/setup-node@v4
3.Install dependenciesnpm ci
4.Buildnpm run build
Add step:
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
GitHub Actions - 技术详情
GitHub Actions automate your software development workflows. Workflows are defined in YAML files in .github/workflows/. They can run on push, pull request, schedule, or manual trigger.
命令行替代方案
# Create workflow directory\nmkdir -p .github/workflows\n\n# Validate workflow\ngh workflow list\ngh run list