Skip to content

Commit b246b93

Browse files
committed
cron-weekly-update: copy toolchain update files from rust-bitcoin
With the move to the latest cargo-rbmt we have replaced our nightly-version files with Cargo.toml entries. Update the cronjob accordingly, and add a new one for the stable compiler version. This moves the update date from Mondays to Saturdays. It's a bit nicer to have Saturday, both because this is the same time as all the other rust-bitcoin PRs are opened so I can bulk-review them, but also because it means I can merge these (usually trivial) PRs on Sunday and not have them mixed up with activity during the workweek.
1 parent e57e698 commit b246b93

2 files changed

Lines changed: 53 additions & 25 deletions

File tree

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
11
name: Update Nightly rustc
22
on:
33
schedule:
4-
- cron: "5 0 * * 1" # runs every Monday at 00:05 UTC
4+
- cron: "5 0 * * 6" # Saturday at 00:05
55
workflow_dispatch: # allows manual triggering
6+
permissions: {}
67
jobs:
78
format:
89
name: Update nightly rustc
9-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: write
13+
id-token: write
14+
pull-requests: write
1015
steps:
11-
- uses: actions/checkout@v4
12-
- uses: dtolnay/rust-toolchain@nightly
13-
- name: Update rust.yml to use latest nightly
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
with:
18+
persist-credentials: false
19+
- name: Install cargo-rbmt
20+
run: cargo install --git https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git --rev $(cat rbmt-version) cargo-rbmt
21+
- name: Update nightly toolchain in Cargo.toml
1422
run: |
15-
set -x
16-
# Not every night has a nightly, so extract the date from whatever
17-
# version of the compiler dtolnay/rust-toolchain gives us.
18-
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
19-
# Update the nightly version in the reference file.
20-
echo "nightly-${NIGHTLY_DATE}" > nightly-version
21-
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
22-
# Some days there is no new nightly. In this case don't make an empty PR.
23-
if ! git diff --exit-code > /dev/null; then
24-
echo "Updated nightly. Opening PR."
25-
echo "changes_made=true" >> $GITHUB_ENV
26-
else
27-
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
28-
echo "changes_made=false" >> $GITHUB_ENV
29-
fi
23+
eval "$(cargo rbmt toolchains --update-nightly)"
24+
echo "nightly_version=$RBMT_NIGHTLY" >> $GITHUB_ENV
3025
- name: Create Pull Request
31-
if: env.changes_made == 'true'
32-
uses: peter-evans/create-pull-request@v6
26+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
3327
with:
3428
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
3529
author: Update Nightly Rustc Bot <bot@example.com>
3630
committer: Update Nightly Rustc Bot <bot@example.com>
37-
title: Automated daily update to rustc (to nightly-${{ env.nightly_date }})
31+
title: Automated daily update to rustc (to ${{ env.nightly_version }})
3832
body: |
39-
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
40-
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
33+
Automated update to Cargo.toml workspace metadata by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
34+
commit-message: Automated update to rustc ${{ env.nightly_version }}
4135
branch: create-pull-request/daily-nightly-update
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Update Stable rustc
2+
on:
3+
schedule:
4+
- cron: "0 0 * * 5" # runs every Friday at 00:00 (generally rust releases on Thursday)
5+
workflow_dispatch: # allows manual triggering
6+
permissions: {}
7+
jobs:
8+
format:
9+
name: Update stable rustc
10+
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
steps:
15+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16+
with:
17+
persist-credentials: false
18+
- name: Install cargo-rbmt
19+
run: cargo install --git https://github.com/rust-bitcoin/rust-bitcoin-maintainer-tools.git --rev $(cat rbmt-version) cargo-rbmt
20+
- name: Update stable toolchain in Cargo.toml
21+
run: |
22+
eval "$(cargo rbmt toolchains --update-stable)"
23+
echo "stable_version=$RBMT_STABLE" >> $GITHUB_ENV
24+
- name: Create Pull Request
25+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
26+
with:
27+
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
28+
author: Update Stable Rustc Bot <bot@example.com>
29+
committer: Update Stable Rustc Bot <bot@example.com>
30+
title: Automated weekly update to rustc stable (to ${{ env.stable_version }})
31+
body: |
32+
Automated update to Cargo.toml workspace metadata by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
33+
commit-message: Automated update to rustc stable-${{ env.stable_version }}
34+
branch: create-pull-request/weekly-stable-update

0 commit comments

Comments
 (0)