-
Notifications
You must be signed in to change notification settings - Fork 290
60 lines (49 loc) · 2.19 KB
/
update-nightly.yml
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
# GitHub Actions CI job to update the Rust toolchain nightly versions used in `rust.yml` every 2 weeks.
#
# Note: This particularly affects the fuzzing CI jobs that have to pin a nightly
# release in order to not invalidate their caches on a daily basis.
name: Update Rust Nightly Version
on:
schedule:
- cron: '0 0 */14 * *' # Every 2 weeks
workflow_dispatch: # Allows to trigger this CI job via GitHub UI
jobs:
update-nightly:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install the latest Rust nightly
uses: dtolnay/rust-toolchain@nightly
- name: Get the latest Rust nightly version
run: |
# Fetch the Rust version, e.g., rustc 1.81.0-nightly (eeb90cda1 2024-09-04)
RUSTC_VERSION=$(rustc --version)
echo "Rustc Version: $RUSTC_VERSION"
# Extract the nightly version date (2024-09-04)
LATEST_NIGHTLY=$(echo $RUSTC_VERSION | grep -Po '\d{4}-\d{2}-\d{2}')
echo "LATEST_NIGHTLY=$LATEST_NIGHTLY" >> $GITHUB_ENV
- name: Create new branch
run: |
git checkout -b update-rust-nightly-$LATEST_NIGHTLY
- name: Update nightly version in CI workflow
run: |
FILE=".github/workflows/rust.yml"
sed -i "s/toolchain: nightly-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/toolchain: nightly-$LATEST_NIGHTLY/" $FILE
- name: Commit changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .github/workflows/rust.yml
git commit -m "Update Rust nightly version to $LATEST_NIGHTLY"
- name: Push changes to new branch
run: |
git push origin update-rust-nightly-$LATEST_NIGHTLY
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-rust-nightly-$LATEST_NIGHTLY
title: "CI: Update Rust nightly version to $LATEST_NIGHTLY"
body: "This PR updates the Rust nightly version to $LATEST_NIGHTLY."
base: main