diff --git a/.github/workflows/chebi.yml b/.github/workflows/chebi.yml index 0273c3ed..8926d57b 100644 --- a/.github/workflows/chebi.yml +++ b/.github/workflows/chebi.yml @@ -50,20 +50,14 @@ jobs: string=$(tail -4 index.html | head -1) ##Extract the date from the latest release (up to the day) date_new=$(echo "$string" | grep -oP '\K[0-9-]+\s[0-9:]+(?=\s+)' | awk '{print $1}') - echo $date_new release=$(echo "$string" | grep -oP '(?<=a href="rel)\d\d\d') - echo "RELEASE=$release" >>$GITHUB_ENV - ##Extract the date from the ChEBI README file (up to the day) + ##Extract the date from the ChEBI README file date_old=$date - echo $date_old - ##Print the dates - ##Compare the dates and set GITHUB_ENV variable if date_new is more recent timestamp1=$(date -d "$date_new" +%s) timestamp2=$(date -d "$date_old" +%s) - echo $timestamp1 - echo $timestamp2 + if [ "$timestamp1" -gt "$timestamp2" ]; then echo "DOWNLOAD_FILE=true" >> $GITHUB_ENV echo 'New release (rel${release}) available' @@ -71,7 +65,7 @@ jobs: echo "DOWNLOAD_FILE=false" >> $GITHUB_ENV echo 'No new release available' fi - echo "Date of latest release: $date_new", "Date of release of the current version: $date_old", "Download: ${{ github.DOWNLOAD_FILE }} + echo "Date of latest release: $date_new", "Date of release of the current version: $date_old", "Download: ${{ github.DOWNLOAD_FILE }}" ##Clean up rm index.htm*