Where is the end of the humain?

github actions jenkins

github workflow 设置yaml文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Frontend pr workflow
on: # 在develop分支上触发PR的build
pull_request:
branches: ["develop"]

jobs:
build: # 任务名
runs-on: [self-hostsd]
steps: # 步骤列表
- uses: actions/checkout@v3 # 步骤使用actions组织的action,切换仓库,版本v3
- name: Use Node.js 16.xx.x # 使用内部action
uses: setupnoderepo
with: # 此处为传参
node-version: 16.xx.x
registry-url: internal public repository url

- name: cache npm dependencies # 使用actions组织的action,仓库缓存
uses: actions/cache@v3
id: npm_cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ bashFiles('package-lock.json') }}

- name: install packages # 运行bash命令的步骤
run: npm install
if: steps.npm_cache.outputs.cache-hit != 'true' #只在没有缓存成功的状态下运行

- run: npm run build # 运行bash命令

- run: npm run test

- name: install and start sonar analysis # 使用内部action 仓库
uses: xxx/sonar-xx@stable
with:
scanner-version: 'xxx'
sonar-properties: 'sonar-project.properties'
sonar-token: ${{ secrets.SONAR_TOKEN}} # token位于仓库的设置安全选项处
#自定义action

- name:my custom private github actions
uses: ./.github/actions/frontend-ci # 这里不能使用 Org/自己的仓库@版本 只能使用相对路径
with:
docker-username: ${{ }}
docker-password: ${{ }}
sonar-dsp-token: ${{ }}
build-image: false

© 2026 iattachの小站

Elegant theme by Shiro · Made by Acris with ❤️