Skip to content

Commit

Permalink
chore: add release note workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinesmilelk committed Sep 10, 2024
1 parent 5524cf9 commit 623596e
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 40 deletions.
33 changes: 33 additions & 0 deletions .changeset/lemon-walls-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
'@difizen/libro-jupyter': patch
'@difizen/libro-core': patch
'@difizen/libro-docs': patch
'@difizen/libro-code-cell': patch
'@difizen/libro-code-editor': patch
'@difizen/libro-codemirror': patch
'@difizen/libro-cofine-editor': patch
'@difizen/libro-cofine-editor-contribution': patch
'@difizen/libro-cofine-editor-core': patch
'@difizen/libro-cofine-textmate': patch
'@difizen/libro-common': patch
'@difizen/libro-kernel': patch
'@difizen/libro-l10n': patch
'@difizen/libro-lab': patch
'@difizen/libro-language-client': patch
'@difizen/libro-lsp': patch
'@difizen/libro-markdown': patch
'@difizen/libro-markdown-cell': patch
'@difizen/libro-output': patch
'@difizen/libro-prompt-cell': patch
'@difizen/libro-raw-cell': patch
'@difizen/libro-rendermime': patch
'@difizen/libro-search': patch
'@difizen/libro-search-code-cell': patch
'@difizen/libro-shared-model': patch
'@difizen/libro-terminal': patch
'@difizen/libro-toc': patch
'@difizen/libro-virtualized': patch
'@difizen/libro-widget': patch
---

test releaser note
86 changes: 46 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,55 @@ name: 'Release'

on:
push:
branches: ['main']
branches: ['ximo_dev']

jobs:
changesets:
# prevents this action from running on forks
if: github.repository == 'difizen/libro'

name: Changesets
uses: difizen/actions/.github/workflows/release-changesets.yml@main
secrets:
BOT_APP_ID: ${{ secrets.BOT_APP_ID }}
BOT_PRIVATE_KEY: ${{ secrets.BOT_PRIVATE_KEY }}

permissions:
pull-requests: write
contents: write

ci:
needs: [changesets]
if: |
needs.changesets.outputs.should-release == 'true'
name: Prerelease CI
uses: ./.github/workflows/ci.yml

permissions:
contents: read
actions: read

publish:
needs: [ci]
if: |
needs.ci.result == 'success'
name: Publish
uses: difizen/actions/.github/workflows/release-publish.yml@main

with:
node-version: '20'
python-version: '3.8'
# 新增的 release-notes Job
release-notes:
name: Generate Release Notes
runs-on: ubuntu-latest

permissions:
contents: write

secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up git
run: |
git fetch --prune --unshallow
git fetch --tags
- name: Get latest tag
id: get_tag
run: |
# 获取最新的符合 @difizen/libro-xxx@ 格式的 tag
LATEST_TAG=$(git describe --tags --abbrev=0)
# 输出最新的 tag
echo "Latest tag: $LATEST_TAG"
# 提取版本号(移除最后一个 '@' 之前的部分)
VERSION=${LATEST_TAG##*@}
# 输出提取的版本号
echo "Extracted version: $VERSION"
# 将版本号设置为输出变量供后续步骤使用
echo "::set-output name=latest_version::$VERSION"
- name: Install dependencies
run: npm install

- name: Generate GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag.outputs.latest_version }} # 使用最近的 tag 作为 tag 名
release_name: Release ${{ steps.get_tag.outputs.latest_version }} # 使用最近的 tag 作为 release 名
body: |
## Changes
$(npx changeset status --snapshot) # 使用 changeset 文案生成 Release Notes
draft: false # 直接发布而非草稿

0 comments on commit 623596e

Please sign in to comment.