Skip to content

Commit

Permalink
Fix latest rust version
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdivine committed Sep 22, 2023
1 parent 8ebe085 commit 05d0de7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/update-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ on:
# check for new rust versions weekly
- cron: '30 3 * * FRI'
workflow_dispatch:
push:
branches:
# The development branch for this workflow:
- "update-rust"
jobs:
rust-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# First, check rust GitHub releases for a new version. We assume that the
# latest version's tag name is the version.
- name: Install yq
run: sudo snap install yq
- name: Check new rust version
id: update
run: |
current_rust_version=$(cat ./rust-toolchain.toml | sed -n 's/^channel[[:space:]]*=[[:space:]]"\(.*\)"/\1/p')
echo "current rust version '$current_rust_version'"
release_data=$(curl --silent -H 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/rust-lang/rust/releases/latest)
latest_rust_version=$(echo -n "$release_data" | jq -cMr .tag_name)
latest_rust_version=$(curl -sSL https://static.rust-lang.org/dist/channel-rust-stable.toml | yq -oy -p toml '.pkg.rust.target.x86_64-unknown-linux-gnu.url' | sed -E 's!https://.*rust-([0-9]+[.][0-9]+[.][0-9]+).*!\1!g')
# The GitHub API has some hiccups, so we check the value before going further
if [ -z "$latest_rust_version" ] || [ "$latest_rust_version" = "null" ]
Expand Down

0 comments on commit 05d0de7

Please sign in to comment.