name: Release on: push: tags: - 'v*' jobs: release: if: ${{ !contains(github.ref_name, '-') }} runs-on: macos-latest permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Get version from tag id: version run: echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT - name: Build run: | xcodebuild \ -project ClaudeChecker.xcodeproj \ -scheme ClaudeChecker \ -configuration Release \ -derivedDataPath build \ clean build - name: Zip app run: | ditto -c -k --keepParent \ build/Build/Products/Release/ClaudeChecker.app \ ClaudeChecker.zip - name: Compute SHA256 id: sha run: echo "sha256=$(shasum -a 256 ClaudeChecker.zip | awk '{print $1}')" >> $GITHUB_OUTPUT - name: Create GitHub release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release create "$GITHUB_REF_NAME" ClaudeChecker.zip \ --title "$GITHUB_REF_NAME" \ --notes "$(cat RELEASE_NOTES.md 2>/dev/null || echo 'Release ${{ steps.version.outputs.version }}')" - name: Update version.json run: | notes=$(cat RELEASE_NOTES.md 2>/dev/null || echo "Release ${{ steps.version.outputs.version }}") jq -n \ --arg version "${{ steps.version.outputs.version }}" \ --arg url "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/ClaudeChecker.zip" \ --arg notes "$notes" \ '{version: $version, url: $url, notes: $notes}' > version.json - name: Update Homebrew cask run: | sed -i '' \ -e 's/version "[^"]*"/version "${{ steps.version.outputs.version }}"/' \ -e 's/sha256 "[^"]*"/sha256 "${{ steps.sha.outputs.sha256 }}"/' \ ../homebrew-tap/Casks/claudechecker.rb 2>/dev/null || true - name: Update README badge env: NEW_VERSION: ${{ steps.version.outputs.version }} run: | python3 -c " import os, re v = os.environ['NEW_VERSION'] content = open('README.md').read() content = re.sub(r'macOS_Stable-[^-]+-orange', 'macOS_Stable-' + v + '-orange', content) lines = content.splitlines(keepends=True) out = ['' + chr(10) if '' in line else line for line in lines] open('README.md', 'w').writelines(out) " - name: Commit version.json and README run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add version.json README.md git commit -m "Release ${{ github.ref_name }}" git pull --rebase origin main git push origin HEAD:main - name: Update Homebrew tap env: TAP_TOKEN: ${{ secrets.TAP_TOKEN }} run: | git clone https://x-access-token:${{ secrets.TAP_TOKEN }}@github.com/${{ github.repository_owner }}/homebrew-tap /tmp/homebrew-tap sed -i '' \ -e 's/version "[^"]*"/version "${{ steps.version.outputs.version }}"/' \ -e 's/sha256 "[^"]*"/sha256 "${{ steps.sha.outputs.sha256 }}"/' \ /tmp/homebrew-tap/Casks/claudechecker.rb cd /tmp/homebrew-tap git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add Casks/claudechecker.rb git commit -m "Update claudechecker to ${{ github.ref_name }}" git push