【发布时间】:2021-12-18 19:56:39
【问题描述】:
我有一个基于 Node/npm 的项目并使用 commitlint、husky 和语义发布。每当我推送到受保护的 main 分支时,我都想创建一个新版本。
在 Github 中我添加了以下工作流程
name: Release on push on main
on:
push:
branches:
- main
jobs:
release-on-push-on-main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: npm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release --branches main
这工作做得很好。当移动到发布时,我看到语义发布附加了源代码
运行npm run build 会为我生成一个包含所有构建文件的dist 文件夹。如何增强我的工作流程以将构建添加到资产?
添加步骤
- name: Run build
run: npm run build
- name: Archive build
uses: actions/upload-artifact@v2
with:
name: build
path: dist
在运行 Release 步骤之前似乎按预期工作
但如何将其作为资产添加到版本中?
【问题讨论】:
标签: github npm github-actions semantic-release