Toolchain Version Check #39
This file contains 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: Toolchain Version Check | |
"on": | |
schedule: | |
- cron: "0 5 * * 5" # 5am UTC Fridays. Rust toolchain versions merge Thursday afternoons. | |
workflow_dispatch: | |
jobs: | |
check-toolchain-version: | |
name: Check toolchain version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Install Ruby toolchain | |
uses: ruby/setup-ruby@c04af2bb7258bb6a03df1d3c1865998ac9390972 # v1.194.0 | |
with: | |
ruby-version: ".ruby-version" | |
bundler-cache: true | |
- name: Read existing rustc version | |
id: rust_version | |
run: | | |
echo "version=$(bundle exec rake toolchain:version)" >> "$GITHUB_OUTPUT" | |
- name: Check the latest rustc version | |
id: latest_rust_release | |
uses: octokit/request-action@872c5c97b3c85c23516a572f02b31401ef82415d # v2.3.1 | |
with: | |
route: GET /repos/{owner}/{repo}/releases/latest | |
owner: rust-lang | |
repo: rust | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract rust version info | |
id: version_info | |
env: | |
CURRENT: ${{ steps.rust_version.outputs.version }} | |
NEXT: ${{ fromJson(steps.latest_rust_release.outputs.data).tag_name }} | |
run: | | |
echo "current=$CURRENT" >> "$GITHUB_OUTPUT" | |
echo "next=$NEXT" >> "$GITHUB_OUTPUT" | |
if [[ "$CURRENT" == "$NEXT" ]]; then | |
echo "matches=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "matches=false" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Update the toolchain version and run sync | |
if: ${{ steps.version_info.outputs.matches != 'true' }} | |
env: | |
CURRENT: ${{ steps.version_info.outputs.current }} | |
NEXT: ${{ steps.version_info.outputs.next }} | |
run: | | |
# Matches `RUST_VERSION = '$CURRENT'` and replaces with `RUST_VERSION = '$NEXT'` | |
sed -i "s/^RUST_VERSION = '$CURRENT'$/RUST_VERSION = '$NEXT'/g" Rakefile | |
bundle exec rake toolchain:sync | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | |
if: ${{ steps.version_info.outputs.matches != 'true' }} | |
with: | |
title: Update Rust toolchain from ${{ steps.version_info.outputs.current }} to ${{ steps.version_info.outputs.next }} | |
body: | | |
> [!WARNING] | |
> This PR is automatically created via a Github Action. Ensure all changes are valid before merging. | |
Update the toolchain and sync to the latest available in rust-lang/rust. | |
Current toolchain version: ${{ steps.version_info.outputs.current }} | |
Latest toolchain version: ${{ steps.version_info.outputs.next }} | |
[Changelog](https://github.com/rust-lang/rust/blob/master/RELEASES.md) | |
[Commits](https://github.com/rust-lang/rust/compare/${{ steps.version_info.outputs.current}}...${{ steps.version_info.outputs.next }}) | |
commit-message: Sync the toolchain to the latest Rust upstream | |
add-paths: | | |
Rakefile | |
**/Dockerfile | |
base: trunk | |
branch: actions/update-toolchain-version | |
labels: | | |
A-deps | |
assignees: | | |
@artichoke/contributors |