💥 回滚工作流

This commit is contained in:
hi2hi 2024-12-09 11:24:45 +00:00
parent 6f1f4d22f0
commit 8e6489ba5c

View File

@ -28,31 +28,35 @@ jobs:
- name: Install dependencies
run: npm install
- name: Get version from package.json
id: get_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
- name: Determine version
id: determine_version
run: |
if [ -z "${{ github.event.inputs.version }}" ]; then
echo "VERSION=$(node -p 'require("./package.json").version')" >> $GITHUB_ENV
if [ "${{ github.event.inputs.version }}" ]; then
echo "::set-output name=version::${{ github.event.inputs.version }}"
else
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "::set-output name=version::${{ steps.get_version.outputs.version }}"
fi
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v$VERSION
name: Release v$VERSION
tag_name: v${{ steps.determine_version.outputs.version }}
release_name: Release v${{ steps.determine_version.outputs.version }}
draft: false
prerelease: false
- name: 构建v0版本 - 完整引用版本
run: npm run build
- name: 打包v0-$VERSION-all.zip
run: zip -r v0-$VERSION-all.zip dist
- name: 打包v0-${{ steps.determine_version.outputs.version }}-all.zip
run: zip -r v0-${{ steps.determine_version.outputs.version }}-all.zip dist
- name: 构建v0版本 - JSDeliver引用版本
env:
@ -61,8 +65,8 @@ jobs:
VITE_CDN_LIB_TYPE: 'jsdelivr'
run: npm run build
- name: 打包v0-$VERSION-cdn-jsdelivr.zip
run: zip -r v0-$VERSION-cdn-jsdelivr.zip dist
- name: 打包v0-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip
run: zip -r v0-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip dist
- name: 构建v0版本 - loli(CDNJS)引用版本
env:
@ -71,8 +75,8 @@ jobs:
VITE_CDN_LIB_TYPE: 'loli'
run: npm run build
- name: 打包v0-$VERSION-cdn-loli.zip
run: zip -r v0-$VERSION-cdn-loli.zip dist
- name: 打包v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip
run: zip -r v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip dist
- name: 构建哪吒v1内置版本
env:
@ -85,34 +89,34 @@ jobs:
- name: 打包dist.zip
run: zip -r dist.zip dist
- name: Upload v0-$VERSION-all.zip
- name: Upload v0-${{ steps.determine_version.outputs.version }}-all.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./v0-$VERSION-all.zip
asset_name: v0-$VERSION-all.zip
asset_path: ./v0-${{ steps.determine_version.outputs.version }}-all.zip
asset_name: v0-${{ steps.determine_version.outputs.version }}-all.zip
asset_content_type: application/zip
- name: Upload v0-$VERSION-cdn-jsdelivr.zip
- name: Upload v0-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./v0-$VERSION-cdn-jsdelivr.zip
asset_name: v0-$VERSION-cdn-jsdelivr.zip
asset_path: ./v0-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip
asset_name: v0-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip
asset_content_type: application/zip
- name: Upload v0-$VERSION-cdn-loli.zip
- name: Upload v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./v0-$VERSION-cdn-loli.zip
asset_name: v0-$VERSION-cdn-loli.zip
asset_path: ./v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip
asset_name: v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip
asset_content_type: application/zip
- name: Upload dist.zip
@ -128,18 +132,19 @@ jobs:
- name: Add release notes
run: |
# 获取最近一次提交的变更内容
git log -1 > changes.txt
git log -1 --pretty=format:"%s%n%b" > changes.txt
# 获取现有的发布说明
gh release view v$VERSION --json body -q .body > body.txt
gh release view v${{ steps.determine_version.outputs.version }} --json body -q .body > body.txt
# 将变更内容添加到发布说明中
echo -e "### Changes in this release\n" >> body.txt
cat changes.txt >> body.txt
# 添加其他发布说明
echo -e "\n哪吒V1请下载dist.zip\n哪吒V0请下载v0-$VERSION-(all|cdn-jsdelivr|cdn-loli).zip\n`all`是全量包,`cdn-jsdelivr`是jsdelivr引用版`cdn-loli`是cdnjs引用版\nv0版本构建物通过修改`./config.js`指定`nezhaVersion`版本为`v1`可以匹配哪吒v1接口" >> body.txt
echo -e "\n哪吒V1请下载dist.zip\n哪吒V0请下载v0-${{ steps.determine_version.outputs.version }}-all.zip\n至于all是全量包cdn-jsdelivr是jsdelivr引用版cdn-loli是cdnjs引用版\nv0版本构建物通过修改./config.js指定nezhaVersion版本可以正常在v1中使用" >> body.txt
# 更新发布说明
gh release edit v$VERSION --notes-file body.txt
gh release edit v${{ steps.determine_version.outputs.version }} --notes-file body.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}