-
Notifications
You must be signed in to change notification settings - Fork 32
72 lines (66 loc) · 2.91 KB
/
check-rust-versions.yml
File metadata and controls
72 lines (66 loc) · 2.91 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Check Supported Rust Versions
on:
schedule:
- cron: "0 17 * * *"
workflow_dispatch:
jobs:
check-rust-eol:
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
target: ${{ steps.parse.outputs.target }}
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
# Perform a GET request to endoflife.date for the Rust language. The response
# contains all Rust releases; we're interested in the 2nd index (antepenultimate).
- name: Fetch officially supported Rust versions
uses: JamesIves/fetch-api-data-action@396ebea7d13904824f85b892b1616985f847301c
with:
endpoint: https://endoflife.date/api/rust.json
configuration: '{ "method": "GET" }'
debug: true
# Parse the response JSON and insert into environment variables for the next step.
# We use the antepenultimate (third most recent) version as our target.
- name: Parse officially supported Rust versions
id: parse
run: |
echo "target=${{ fromJSON(env.fetch-api-data)[2].cycle }}" >> $GITHUB_OUTPUT
create-prs:
permissions:
contents: write
pull-requests: write
needs: check-rust-eol
runs-on: ubuntu-latest
env:
officialTargetVersion: ${{ needs.check-rust-eol.outputs.target }}
steps:
- uses: actions/checkout@v4
- name: Get current Rust version
id: rust-versions
run: cat ./.github/variables/rust-versions.env >> $GITHUB_OUTPUT
- name: Update rust-versions.env and Cargo.toml
if: steps.rust-versions.outputs.target != env.officialTargetVersion
id: update-rust-versions
run: |
# Update the versions file
sed -i -e "s#target=[^ ]*#target=${{ env.officialTargetVersion }}#g" \
./.github/variables/rust-versions.env
# Update Cargo.toml rust-version field
sed -i -e "s#rust-version = \"[^\"]*\"#rust-version = \"${{ env.officialTargetVersion }}.0\"#g" \
./eventsource-client/Cargo.toml
- name: Create pull request
if: steps.update-rust-versions.outcome == 'success'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: |
.github/variables/rust-versions.env
eventsource-client/Cargo.toml
branch: "launchdarklyreleasebot/update-to-rust${{ env.officialTargetVersion }}"
author: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
committer: "LaunchDarklyReleaseBot <LaunchDarklyReleaseBot@launchdarkly.com>"
title: "fix: Bump MSRV from ${{ steps.rust-versions.outputs.target }} to ${{ env.officialTargetVersion }}"
body: |
- [ ] I have triggered CI on this PR (either close & reopen this PR in Github UI, or `git commit -m "run ci" --allow-empty && git push`)