ci: pin stable in semver-checks and updates weekly

This commit is contained in:
Jose Storopoli 2024-07-11 08:41:13 +00:00
parent 1948995443
commit 4edd504cb6
No known key found for this signature in database
GPG Key ID: BCD6BC0FC1D110A5
3 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,40 @@
name: Update Stable rustc
on:
schedule:
- cron: "0 0 * * 5" # runs every Friday at 00:00 (generally rust releases on Thursday)
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update stable rustc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Update semver-checks.yml to use latest stable
run: |
set -x
# Extract the version of the compiler dtolnay/rust-toolchain gives us.
STABLE_VERSION=$(rustc --version | sed -ne 's/^rustc //p' | cut -d ' ' -f1)
# Update the stable version in the reference file.
echo "${STABLE_VERSION}" > ./.github/workflows/stable-version
echo "stable_version=${STABLE_VERSION}" >> $GITHUB_ENV
# If somehow the stable version has not changed. In this case don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated stable. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update stable but the latest-stable date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
author: Update Stable Rustc Bot <bot@example.com>
committer: Update Stable Rustc Bot <bot@example.com>
title: Automated weekly update to rustc stable (to ${{ env.stable_version }})
body: |
Automated update to Github CI workflow `semver-checks.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to rustc stable-${{ env.stable_version }}
branch: create-pull-request/weekly-stable-update

View File

@ -5,7 +5,7 @@ name: Check semver breaks
jobs:
PR:
name: PR Semver - nightly toolchain
name: PR Semver - stable toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
@ -16,6 +16,9 @@ jobs:
fetch-depth: 0 # we need full history for cargo semver-checks
- name: "Install Rustup"
uses: dtolnay/rust-toolchain@stable
- name: "Select stable-version"
run: |
rustup default $(cat ./.github/workflows/stable-version)
- name: "Install cargo-binstall"
uses: cargo-bins/cargo-binstall@main
- name: "Binstall cargo-semver-checks"
@ -50,6 +53,9 @@ jobs:
uses: actions/checkout@v4
- name: "Install Rustup"
uses: dtolnay/rust-toolchain@stable
- name: "Select stable-version"
run: |
rustup default $(cat ./.github/workflows/stable-version)
- name: "Install cargo-binstall"
uses: cargo-bins/cargo-binstall@main
- name: "Binstall cargo-semver-checks"

1
.github/workflows/stable-version vendored Normal file
View File

@ -0,0 +1 @@
1.79.0