diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9827074..ec0e68d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,11 +84,40 @@ jobs: contents: write steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + - name: Download all artifacts uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 with: path: artifacts + - name: Update version in Cargo.toml and Cargo.lock + run: | + # Extract version from tag (remove 'v' prefix if present) + VERSION="${GITHUB_REF#refs/tags/}" + VERSION="${VERSION#v}" + + # Install cargo-edit for version bumping + cargo install cargo-edit + + # Update Cargo.toml version + cargo set-version "$VERSION" + + # Configure git + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + # Commit and push changes + git add Cargo.toml Cargo.lock + git commit -m "chore: bump version to $VERSION" || echo "No changes to commit" + git push origin HEAD:main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release uses: softprops/action-gh-release@v2 with: