Update Recipes #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Recipes | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "2,22,42 * * * *" | |
jobs: | |
update-recpies: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Update -dev package | |
shell: bash | |
run: | | |
export oldVersion=$(cat Casks/d/deskflow-dev.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]+$') | |
wget https://github.com/deskflow/deskflow/releases/download/continuous/sums.txt -q | |
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]+$') | |
# These will be written into the files | |
export A_SHA=$(cat sums.txt | grep deskflow-continuous-macos-arm64.dmg | sed -e 's/des.*//g' | sed -e 's/ //g') | |
export I_SHA=$(cat sums.txt | grep deskflow-continuous-macos-x86_64.dmg | sed -e 's/des.*//g' | sed -e 's/ //g') | |
#continuous release can only ever be newer | |
if [[ "$oldVersion" != "$newVersion" ]]; then | |
echo "New Version $newVersion" | |
sed -i "s/version \".*\"/version \"$newVersion\"/" Casks/d/deskflow-dev.rb | |
sed -i "s/sha256 arm:.*\".*\", intel: \".*\"/sha256 arm: \"$A_SHA\", intel: \"$I_SHA\"/" Casks/d/deskflow-dev.rb | |
git config --global user.name 'df-bot' | |
git config --global user.email '[email protected]' | |
git commit Casks/d/deskflow-dev.rb -m "deskflow-dev: $newVersion" | |
git push -u origin HEAD | |
else | |
echo "Same version" | |
fi | |