-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 3.24 KB
/
toolchain-version-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
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@4a9ddd6f338a97768b8006bf671dfbad383215f4 # v1.207.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@dad4362715b7fb2ddedf9772c8670824af564f0d # v2.4.0
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@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
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