-
Notifications
You must be signed in to change notification settings - Fork 289
44 lines (36 loc) · 1.63 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
# 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@v2
- 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: 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 and push 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"
git push