Create Release PR #3
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: Create Release PR | |
| on: | |
| push: | |
| tags: | |
| - 'loro-crdt@*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag name (e.g., [email protected])' | |
| required: true | |
| type: string | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Deno | |
| uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Extract version | |
| id: version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/loro-crdt@} | |
| echo "version=$VERSION" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create Release PR | |
| id: release | |
| run: | | |
| cargo install cargo-release | |
| # Run cargo release and capture the output | |
| echo "Starting release process..." | |
| echo "Running deno script with version: ${{ steps.version.outputs.version }}" | |
| deno run -A scripts/cargo-release-cli.ts ${{ steps.version.outputs.version }} 2>&1 | tee debug_output.log | |
| RELEASE_OUTPUT=$(tail -n 1 debug_output.log) | |
| echo "EXCLUDED_FLAGS=$RELEASE_OUTPUT" | |
| echo "EXCLUDED_FLAGS=$RELEASE_OUTPUT" >> $GITHUB_OUTPUT | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| title: "chore: release rust crates v${{ steps.version.outputs.version }}" | |
| body: | | |
| This PR is automatically created to release version ${{ steps.version.outputs.version }}. | |
| Please review the changes and merge to trigger the release. | |
| <!-- RELEASE_FLAGS: ${{ steps.release.outputs.EXCLUDED_FLAGS }} --> | |
| branch: release-rust | |
| add-paths: | | |
| . | |
| base: main | |
| commit-message: "chore: bump version to ${{ steps.version.outputs.version }}" |