Skip to content

Commit

Permalink
update deskflow update job
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed Nov 8, 2024
1 parent b36570f commit 3edcee8
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/deskflow-update-check.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Update deskflow-dev
name: Update deskflow
on:
workflow_dispatch:
push:
schedule:
- cron: "3,23,43 * * * *"

jobs:
update-deskflow-dev:
update-deskflow:
runs-on: ubuntu-latest
timeout-minutes: 10

Expand All @@ -16,22 +16,23 @@ jobs:
with:
fetch-depth: 1

- name: Update -dev package
- name: Update deskflow cask
shell: bash
run: |
export oldVersion=$(cat Casks/d/deskflow.rb | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
export oldMajor=$(echo $oldVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '^[0-9]+')
export oldMinor=$(echo $oldVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '\.[0-9]+\.' | sed -e 's/\.//g')
export oldPatch=$(echo $oldVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '\.[0-9]+\.[0-9]+' | grep -oE '[0-9]+$')
export oldTweak=$(echo $oldVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '[0-9]+$')
export oldVersion=$(cat Casks/d/deskflow.rb | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
export oldMajor=$(echo $oldVersion | grep -oE '^[0-9]+')
export oldMinor=$(echo $oldVersion | grep -oE '\.[0-9]+\.' | sed -e 's/\.//g')
export oldPatch=$(echo $oldVersion | grep -oE '[0-9]+$')
echo "Ver $oldVersion"
curl -s https://api.github.com/repos/deskflow/deskflow/releases/latest | awk -F\" '/browser_download_url/{print $(NF-1)}' | grep sums | wget -q -i -
export newVersion=$(cat sums.txt | grep Build: | sed -e 's/Build: //g')
export newMajor=$(echo $newVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '^[0-9]+')
export newMinor=$(echo $newVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '\.[0-9]+\.' | sed -e 's/\.//g')
export newPatch=$(echo $newVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '\.[0-9]+\.[0-9]+' | grep -oE '[0-9]+$')
export newTweak=$(echo $newVersion | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | grep -oE '[0-9]+$')
export newVersion=$(cat sums.txt | grep Build: | sed -e 's/Build: //g' | grep -oE "[0-9]+\.[0-9]+\.[0-9]+")
export newMajor=$(echo $newVersion | grep -oE '^[0-9]+')
export newMinor=$(echo $newVersion | grep -oE '\.[0-9]+\.' | sed -e 's/\.//g')
export newPatch=$(echo $newVersion | grep -oE '\.[0-9]+\.[0-9]+' | grep -oE '[0-9]+$')
echo "Ver $newVersion"
# These will be written into the files
export A_SHA=$(cat sums.txt | grep macos-arm64.dmg | sed -e 's/des.*//g' | sed -e 's/ //g')
Expand All @@ -40,7 +41,7 @@ jobs:
if [[ "$oldVersion" == "$newVersion" ]]; then
echo " Same Version"
exit 0
elif [[ "$oldMajor" -gt "$newMajor" ]]; then
elif [ "$oldMajor" -gt "$newMajor" ]; then
echo " major version is not newer"
exit 0
elif [ "$oldMajor" -eq "$newMajor" ] && [ "$oldMinor" -gt "$newMinor" ]; then
Expand All @@ -49,9 +50,6 @@ jobs:
elif [ "$oldMajor" -eq "$newMajor" ] && [ "$oldMinor" -eq "$newMinor" ] && [ "$oldPatch" -gt "$newPatch" ]; then
echo "Patch version is not newer"
exit 0
elif [ "$oldMajor" -eq "$newMajor" ] && [ "$oldMinor" -eq "$newMinor" ] && [ "$oldPatch" -eq "$newPatch" ] && [ "$oldTweak" -gt "$newTweak" ]; then
echo "TWEAK version is not newer"
exit 0
else
echo "New Version $newVersion"
sed -i "s/version \".*\"/version \"$newVersion\"/" Casks/d/deskflow.rb
Expand Down

0 comments on commit 3edcee8

Please sign in to comment.