Merge pull request #32 from dtolnay/ago

Make sure the 'ago' syntax specifies 'stable'
This commit is contained in:
David Tolnay 2022-09-25 07:58:09 -07:00 committed by GitHub
commit 2e4fc08e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -18,7 +18,7 @@ jobs:
matrix: matrix:
name: [Linux] name: [Linux]
os: [ubuntu] os: [ubuntu]
rust: [nightly, beta, stable, 1.62.0, 1.0.0, 18 months ago, stable minus 8 releases] rust: [nightly, beta, stable, 1.62.0, 1.0.0, stable 18 months ago, stable minus 8 releases]
include: include:
- name: macOS - name: macOS
os: macos os: macos
@ -28,7 +28,7 @@ jobs:
rust: 1.62.0 rust: 1.62.0
- name: macOS - name: macOS
os: macos os: macos
rust: 18 months ago rust: stable 18 months ago
- name: macOS - name: macOS
os: macos os: macos
rust: stable minus 8 releases rust: stable minus 8 releases
@ -40,7 +40,7 @@ jobs:
rust: 1.62.0 rust: 1.62.0
- name: Windows - name: Windows
os: windows os: windows
rust: 18 months ago rust: stable 18 months ago
- name: Windows - name: Windows
os: windows os: windows
rust: stable minus 8 releases rust: stable minus 8 releases

View file

@ -67,7 +67,7 @@ compiler support.
# offset, which may be written in years, months, weeks, or days. # offset, which may be written in years, months, weeks, or days.
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: 18 months ago toolchain: stable 18 months ago
``` ```
```yaml ```yaml

View file

@ -30,11 +30,11 @@ runs:
- id: parse - id: parse
run: | run: |
: parse toolchain version : parse toolchain version
if [[ $toolchain =~ ^[0-9]+' '(year|month|week|day)s?' 'ago$ ]]; then if [[ $toolchain =~ ^stable' '[0-9]+' '(year|month|week|day)s?' 'ago$ ]]; then
if [[ ${{runner.os}} == macOS ]]; then if [[ ${{runner.os}} == macOS ]]; then
echo "::set-output name=toolchain::1.$((($(date -v-$(sed 's/\([0-9]*\) \(.\).*/\1\2/' <<< $toolchain) +%s)/60/60/24-16569)/7/6))" echo "::set-output name=toolchain::1.$((($(date -v-$(sed 's/stable \([0-9]*\) \(.\).*/\1\2/' <<< $toolchain) +%s)/60/60/24-16569)/7/6))"
else else
echo "::set-output name=toolchain::1.$((($(date --date "$toolchain" +%s)/60/60/24-16569)/7/6))" echo "::set-output name=toolchain::1.$((($(date --date "${toolchain#stable }" +%s)/60/60/24-16569)/7/6))"
fi fi
elif [[ $toolchain =~ ^stable' 'minus' '[0-9]+' 'releases?$ ]]; then elif [[ $toolchain =~ ^stable' 'minus' '[0-9]+' 'releases?$ ]]; then
echo "::set-output name=toolchain::1.$((($(date +%s)/60/60/24-16569)/7/6-${toolchain//[^0-9]/}))" echo "::set-output name=toolchain::1.$((($(date +%s)/60/60/24-16569)/7/6-${toolchain//[^0-9]/}))"