diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 99575c3..ef5f7cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,15 +30,15 @@ jobs: - name: Get version from package.json id: get_version - run: echo "::set-output name=version::$(node -p "require('./package.json').version")" + run: echo "version=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV - name: Determine version id: determine_version run: | if [ "${{ github.event.inputs.version }}" ]; then - echo "::set-output name=version::${{ github.event.inputs.version }}" + echo "version=${{ github.event.inputs.version }}" >> $GITHUB_ENV else - echo "::set-output name=version::${{ steps.get_version.outputs.version }}" + echo "version=${{ steps.get_version.outputs.version }}" >> $GITHUB_ENV fi - name: Create Release @@ -47,16 +47,16 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: v${{ steps.determine_version.outputs.version }} - release_name: Release v${{ steps.determine_version.outputs.version }} + tag_name: v${{ env.version }} + release_name: Release v${{ env.version }} draft: false prerelease: false - name: 构建v0版本 - 完整引用版本 run: npm run build - - name: 打包v0-${{ steps.determine_version.outputs.version }}-all.zip - run: zip -r v0-${{ steps.determine_version.outputs.version }}-all.zip dist + - name: 打包v0-${{ env.version }}-all.zip + run: zip -r v0-${{ env.version }}-all.zip dist - name: 构建v0版本 - JSDeliver引用版本 env: @@ -65,8 +65,8 @@ jobs: VITE_CDN_LIB_TYPE: 'jsdelivr' run: npm run build - - 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-${{ env.version }}-cdn-jsdelivr.zip + run: zip -r v0-${{ env.version }}-cdn-jsdelivr.zip dist - name: 构建v0版本 - loli(CDNJS)引用版本 env: @@ -75,8 +75,8 @@ jobs: VITE_CDN_LIB_TYPE: 'loli' run: npm run build - - name: 打包v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip - run: zip -r v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip dist + - name: 打包v0-${{ env.version }}-cdn-loli.zip + run: zip -r v0-${{ env.version }}-cdn-loli.zip dist - name: 构建哪吒v1内置版本 env: @@ -89,34 +89,34 @@ jobs: - name: 打包dist.zip run: zip -r dist.zip dist - - name: Upload v0-${{ steps.determine_version.outputs.version }}-all.zip + - name: Upload v0-${{ env.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-${{ steps.determine_version.outputs.version }}-all.zip - asset_name: v0-${{ steps.determine_version.outputs.version }}-all.zip + asset_path: ./v0-${{ env.version }}-all.zip + asset_name: v0-${{ env.version }}-all.zip asset_content_type: application/zip - - name: Upload v0-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip + - name: Upload v0-${{ env.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-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip - asset_name: v0-${{ steps.determine_version.outputs.version }}-cdn-jsdelivr.zip + asset_path: ./v0-${{ env.version }}-cdn-jsdelivr.zip + asset_name: v0-${{ env.version }}-cdn-jsdelivr.zip asset_content_type: application/zip - - name: Upload v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip + - name: Upload v0-${{ env.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-${{ steps.determine_version.outputs.version }}-cdn-loli.zip - asset_name: v0-${{ steps.determine_version.outputs.version }}-cdn-loli.zip + asset_path: ./v0-${{ env.version }}-cdn-loli.zip + asset_name: v0-${{ env.version }}-cdn-loli.zip asset_content_type: application/zip - name: Upload dist.zip @@ -135,16 +135,16 @@ jobs: git log -1 > changes.txt # 获取现有的发布说明 - gh release view v${{ steps.determine_version.outputs.version }} --json body -q .body > body.txt + gh release view v${{ env.version }} --json body -q .body > body.txt # 将变更内容添加到发布说明中 echo -e "### 本次发布\n" >> body.txt cat changes.txt >> body.txt # 添加其他发布说明 - echo -e "\n哪吒V1请下载dist.zip\n哪吒V0请下载v0-${{ steps.determine_version.outputs.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-${{ env.version }}-(all|cdn-jsdelivr|cdn-loli).zip\n`all`是全量包,`cdn-jsdelivr`是jsdelivr引用版,`cdn-loli`是cdnjs引用版\nv0版本构建物通过修改`./config.js`指定`nezhaVersion`版本为`v1`可以匹配哪吒v1接口" >> body.txt # 更新发布说明 - gh release edit v${{ steps.determine_version.outputs.version }} --notes-file body.txt + gh release edit v${{ env.version }} --notes-file body.txt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}