|
1 | 1 | name: Update Nightly rustc |
2 | 2 | on: |
3 | 3 | schedule: |
4 | | - - cron: "5 0 * * 1" # runs every Monday at 00:05 UTC |
| 4 | + - cron: "5 0 * * 6" # Saturday at 00:05 |
5 | 5 | workflow_dispatch: # allows manual triggering |
| 6 | +permissions: {} |
6 | 7 | jobs: |
7 | 8 | format: |
8 | 9 | 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 |
10 | 15 | 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 |
14 | 22 | 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 |
30 | 25 | - 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 |
33 | 27 | with: |
34 | 28 | token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }} |
35 | 29 | author: Update Nightly Rustc Bot <bot@example.com> |
36 | 30 | 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 }}) |
38 | 32 | 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 }} |
41 | 35 | branch: create-pull-request/daily-nightly-update |
0 commit comments