Skip to content

WorkAny v0.1.19

WorkAny v0.1.19 #6

Workflow file for this run

name: Update Homebrew Cask
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to update (e.g., 0.1.14)"
required: true
type: string
jobs:
update-cask:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
# Remove 'v' prefix from tag name
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
else
VERSION="${{ github.event.inputs.version }}"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Calculate SHA256 for ARM64 DMG
id: sha_arm
run: |
URL="https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.version }}/WorkAny_${{ steps.version.outputs.version }}_aarch64.dmg"
echo "Downloading from: $URL"
SHA=$(curl -sfL "$URL" | shasum -a 256 | cut -d ' ' -f 1)
if [ -z "$SHA" ]; then
echo "Error: Failed to download ARM64 DMG"
exit 1
fi
echo "sha=$SHA" >> $GITHUB_OUTPUT
echo "ARM64 SHA256: $SHA"
- name: Calculate SHA256 for Intel DMG
id: sha_intel
run: |
URL="https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.version }}/WorkAny_${{ steps.version.outputs.version }}_x64.dmg"
echo "Downloading from: $URL"
SHA=$(curl -sfL "$URL" | shasum -a 256 | cut -d ' ' -f 1)
if [ -z "$SHA" ]; then
echo "Error: Failed to download Intel DMG"
exit 1
fi
echo "sha=$SHA" >> $GITHUB_OUTPUT
echo "Intel SHA256: $SHA"
- name: Update Cask file
run: |
CASK_FILE="Casks/workany.rb"
VERSION="${{ steps.version.outputs.version }}"
ARM_SHA="${{ steps.sha_arm.outputs.sha }}"
INTEL_SHA="${{ steps.sha_intel.outputs.sha }}"
echo "Updating $CASK_FILE"
echo " Version: $VERSION"
echo " ARM64 SHA: $ARM_SHA"
echo " Intel SHA: $INTEL_SHA"
sed -i "s/version \"[^\"]*\"/version \"$VERSION\"/" "$CASK_FILE"
sed -i "s/sha256 arm: \"[^\"]*\"/sha256 arm: \"$ARM_SHA\"/" "$CASK_FILE"
sed -i "s/intel: \"[^\"]*\"/intel: \"$INTEL_SHA\"/" "$CASK_FILE"
echo "Updated content:"
head -15 "$CASK_FILE"
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/workany.rb
git commit -m "chore: update homebrew cask to v${{ steps.version.outputs.version }}"
git push