Update deskflow-dev #407
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
# 2024 Chris Rizzitello <[email protected]> | |
# Simple job to check if continuous tag on deskflow/deskflow was updated | |
# Update the cask deskflow-dev with the new sha256 sums and commit it to this repo | |
# Cask recipe must have sha256 line on a single line for this to work | |
# Ex: sha256sum arm: "quotedshaArm" intel: "quotedshaforIntel" | |
name: Update deskflow-dev | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "2,22,42 * * * *" | |
jobs: | |
update-deskflow-dev: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Update deskflow-dev Cask | |
shell: bash | |
run: | | |
export oldVersion=$(cat Casks/d/deskflow-dev.rb | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[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') | |
# 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') | |
export I_SHA=$(cat sums.txt | grep 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 "${{github.actor}}" | |
git config --global user.email "${{github.actor}}@users.noreply.github.com" | |
git commit Casks/d/deskflow-dev.rb -m "deskflow-dev: $newVersion" | |
git push -u origin HEAD | |
else | |
echo "Same version" | |
fi | |