From b0ac977a3db12b7c2e9d206ccad1c33496664a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=AD=A3=E8=B6=85?= Date: Wed, 2 Jul 2025 23:31:17 +0800 Subject: [PATCH] feat: restrict build triggers and add GitHub release automation (#34) - Only execute builds on tag push, scheduled runs, or commit message contains --build - Add latest.json version tracking to rustfs-version OSS bucket - Create GitHub Release with all build artifacts automatically - Update comments to English for consistency - Reduce unnecessary CI resource usage while maintaining automation --- .github/workflows/build.yml | 83 +++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 44347dec4..a86da11d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -581,3 +581,86 @@ jobs: name: rustfs-packages pattern: "rustfs-*" delete-merged: true + + # Create GitHub Release with all build artifacts + release: + runs-on: ubuntu-latest + needs: [merge] + if: startsWith(github.ref, 'refs/tags/') + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4.2.2 + + - name: Download merged artifacts + uses: actions/download-artifact@v4 + with: + name: rustfs-packages + path: ./release-artifacts + + - name: Display downloaded artifacts + run: | + echo "Downloaded artifacts:" + ls -la ./release-artifacts/ + find ./release-artifacts -name "*.zip" -exec basename {} \; + + - name: Extract version and create release notes + id: release_info + run: | + # Extract version from tag + VERSION="${GITHUB_REF#refs/tags/}" + VERSION_CLEAN="${VERSION#v}" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "version_clean=${VERSION_CLEAN}" >> $GITHUB_OUTPUT + + # Create release notes + cat > release_notes.md << EOF + ## RustFS ${VERSION_CLEAN} + + ### 🚀 Binary Downloads + + Choose the appropriate binary for your platform: + + **Linux:** + - \`rustfs-release-x86_64-unknown-linux-musl.zip\` - Linux x86_64 (static binary) + - \`rustfs-release-x86_64-unknown-linux-gnu.zip\` - Linux x86_64 (glibc) + - \`rustfs-release-aarch64-unknown-linux-musl.zip\` - Linux ARM64 (static binary) + + **macOS:** + - \`rustfs-release-aarch64-apple-darwin.zip\` - macOS Apple Silicon (M1/M2) + + **GUI Applications:** + - \`rustfs-gui-release-*.zip\` - GUI applications for different platforms + + ### 📦 Installation + + 1. Download the appropriate binary for your platform + 2. Extract the archive + 3. Make the binary executable: \`chmod +x rustfs\` + 4. Move to your PATH: \`sudo mv rustfs /usr/local/bin/\` + + ### 🔗 Alternative Downloads + + - [OSS Mirror](https://rustfs-artifacts.oss-cn-beijing.aliyuncs.com/artifacts/rustfs/) + + --- + + **Full Changelog**: https://github.com/rustfs/rustfs/compare/\${GITHUB_REF#refs/tags/}...${VERSION} + EOF + + echo "Generated release notes:" + cat release_notes.md + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.release_info.outputs.version }} + name: "RustFS ${{ steps.release_info.outputs.version_clean }}" + body_path: release_notes.md + files: ./release-artifacts/*.zip + draft: false + prerelease: ${{ contains(steps.release_info.outputs.version, 'alpha') || contains(steps.release_info.outputs.version, 'beta') || contains(steps.release_info.outputs.version, 'rc') }} + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}