File tree 2 files changed +30
-1
lines changed
.github/actions/fetch_ctk
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 51
51
shell : bash --noprofile --norc -xeuo pipefail {0}
52
52
run : |
53
53
CUDA_PATH="./cuda_toolkit"
54
- mkdir -p $CUDA_PATH
54
+ rm -f $CUDA_PATH
55
+ mkdir $CUDA_PATH
55
56
56
57
# The binary archives (redist) are guaranteed to be updated as part of the release posting.
57
58
CTK_BASE_URL="https://developer.download.nvidia.com/compute/cuda/redist/"
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # URL to search
3
+ URL=" https://developer.download.nvidia.com/compute/cuda/redist/"
4
+
5
+ # Fetch the directory listing and extract the latest version number
6
+ get_latest_version () {
7
+ # Get the HTML content of the page
8
+ local html_content=$( wget -q -O - " $URL " )
9
+
10
+ # Extract links matching the pattern redistrib_?.?.?.json
11
+ local files=$( echo " $html_content " | grep -oP ' redistrib_[0-9]+\.[0-9]+\.[0-9]+\.json' | cut -d' "' -f2)
12
+
13
+ # If files were found, extract the version numbers and find the latest
14
+ if [ -n " $files " ]; then
15
+ # Extract just the version numbers using regex
16
+ local versions=$( echo " $files " | grep -oP ' redistrib_\K[0-9]+\.[0-9]+\.[0-9]+(?=\.json)' )
17
+
18
+ # Sort the versions and get the latest
19
+ local latest_version=$( echo " $versions " | sort -V | tail -n 1)
20
+ echo " $latest_version "
21
+ else
22
+ echo " No files matching the pattern were found."
23
+ return 1
24
+ fi
25
+ }
26
+
27
+ # Call the function and store the result
28
+ latest_version=$( get_latest_version)
You can’t perform that action at this time.
0 commit comments