release: v8.8.8 Shell版最终版本,项目归档转向Go重构 #22
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release to Main | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| - '*.*.*' | |
| - 'v*.*.*-stable' | |
| - '*.*.*-stable' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 获取所有历史以生成changelog | |
| - name: Get version from tag | |
| id: get_version | |
| run: | | |
| TAG=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG#v} | |
| echo "TAG=$TAG" >> $GITHUB_OUTPUT | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Install shc | |
| run: | | |
| sudo add-apt-repository ppa:neurobin/ppa -y | |
| sudo apt-get update | |
| sudo apt-get install shc -y | |
| - name: Compile script to binary | |
| run: | | |
| shc -f PVE-Tools.sh -o pve-tools | |
| chmod +x pve-tools | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| # 生成基于提交历史的发布说明 | |
| LATEST_TAG=${{ steps.get_version.outputs.TAG }} | |
| # 尝试获取前一个 tag,如果没有则为空 | |
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "") | |
| if [ -z "$PREVIOUS_TAG" ]; then | |
| CHANGELOG=$(git log --pretty=format:"- %s (%an)" $LATEST_TAG) | |
| else | |
| CHANGELOG=$(git log --pretty=format:"- %s (%an)" $PREVIOUS_TAG..$LATEST_TAG) | |
| fi | |
| echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.TAG }} | |
| name: Release ${{ steps.get_version.outputs.TAG }} | |
| body: | | |
| ## 版本 ${{ steps.get_version.outputs.VERSION }} | |
| ### 更新日志 | |
| ${{ steps.release_notes.outputs.CHANGELOG }} | |
| ### 使用方法 | |
| **方式一:直接运行脚本 (推荐)** | |
| ```bash | |
| bash -c "$(curl -fsSL https://raw.githubusercontent.com/Mapleawaa/PVE-Tools-9/main/PVE-Tools.sh)" | |
| ``` | |
| **方式二:下载二进制文件** | |
| 下载下方 Assets 中的 `pve-tools`,赋予执行权限后运行: | |
| ```bash | |
| chmod +x pve-tools | |
| ./pve-tools | |
| ``` | |
| files: | | |
| pve-tools | |
| PVE-Tools.sh | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |