|
| 1 | +name: Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: macos-15 |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 19 | + |
| 20 | + - name: Get version from tag |
| 21 | + id: version |
| 22 | + run: | |
| 23 | + TAG="${GITHUB_REF#refs/tags/}" |
| 24 | + VERSION="${TAG#v}" |
| 25 | + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" |
| 26 | + echo "number=${VERSION}" >> "$GITHUB_OUTPUT" |
| 27 | +
|
| 28 | + - name: Update app version in Xcode project |
| 29 | + run: | |
| 30 | + sed -i '' "s/MARKETING_VERSION = .*;/MARKETING_VERSION = ${{ steps.version.outputs.number }};/g" Wirdi/Wirdi.xcodeproj/project.pbxproj |
| 31 | +
|
| 32 | + - name: Commit version bump |
| 33 | + run: | |
| 34 | + git config user.name "github-actions[bot]" |
| 35 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 36 | + git add Wirdi/Wirdi.xcodeproj/project.pbxproj |
| 37 | + git commit -m "Bump version to ${{ steps.version.outputs.number }}" || echo "No changes to commit" |
| 38 | + git push origin HEAD:refs/heads/main || echo "Push skipped" |
| 39 | +
|
| 40 | + - name: Select Xcode |
| 41 | + run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer |
| 42 | + |
| 43 | + - name: Build universal app |
| 44 | + working-directory: Wirdi |
| 45 | + run: | |
| 46 | + chmod +x build.sh |
| 47 | + ./build.sh |
| 48 | +
|
| 49 | + - name: Upload DMG to GitHub Release |
| 50 | + uses: softprops/action-gh-release@v2 |
| 51 | + with: |
| 52 | + files: Wirdi/build/release/Wirdi.dmg |
| 53 | + name: Wirdi ${{ steps.version.outputs.tag }} |
| 54 | + draft: false |
| 55 | + prerelease: false |
| 56 | + generate_release_notes: true |
| 57 | + body: | |
| 58 | + ## Installation |
| 59 | +
|
| 60 | + 1. Download **Wirdi.dmg** below |
| 61 | + 2. Open the DMG and drag **Wirdi** to Applications |
| 62 | + 3. Since the app is not notarized, macOS may block it on first launch. Run the following command in Terminal to fix this: |
| 63 | +
|
| 64 | + ``` |
| 65 | + xattr -cr /Applications/Wirdi.app |
| 66 | + ``` |
| 67 | +
|
| 68 | + Then open Wirdi normally. |
| 69 | +
|
| 70 | + - name: Compute DMG SHA256 |
| 71 | + id: sha |
| 72 | + run: echo "sha256=$(shasum -a 256 Wirdi/build/release/Wirdi.dmg | awk '{print $1}')" >> "$GITHUB_OUTPUT" |
| 73 | + |
| 74 | + - name: Update Homebrew Cask tap |
| 75 | + env: |
| 76 | + TAP_REPO_TOKEN: ${{ secrets.TAP_REPO_TOKEN }} |
| 77 | + VERSION: ${{ steps.version.outputs.tag }} |
| 78 | + SHA256: ${{ steps.sha.outputs.sha256 }} |
| 79 | + run: | |
| 80 | + VERSION_NUM="${VERSION#v}" |
| 81 | + git clone https://x-access-token:${TAP_REPO_TOKEN}@github.com/davut/homebrew-wirdi.git tap |
| 82 | + mkdir -p tap/Casks |
| 83 | + cat > tap/Casks/wirdi.rb << EOF |
| 84 | + cask "wirdi" do |
| 85 | + version "${VERSION_NUM}" |
| 86 | + sha256 "${SHA256}" |
| 87 | +
|
| 88 | + url "https://github.com/davut/wirdi/releases/download/${VERSION}/Wirdi.dmg" |
| 89 | + name "Wirdi" |
| 90 | + desc "Quran reading companion with word-by-word tracking in a Dynamic Island overlay" |
| 91 | + homepage "https://github.com/davut/wirdi" |
| 92 | +
|
| 93 | + depends_on macos: ">= :sequoia" |
| 94 | +
|
| 95 | + app "Wirdi.app" |
| 96 | +
|
| 97 | + postflight do |
| 98 | + system_command "/usr/bin/xattr", args: ["-cr", "#{appdir}/Wirdi.app"] |
| 99 | + end |
| 100 | +
|
| 101 | + zap trash: [ |
| 102 | + "~/Library/Preferences/co.owlapps.wirdi.plist", |
| 103 | + "~/Library/Saved Application State/co.owlapps.wirdi.savedState", |
| 104 | + ] |
| 105 | + end |
| 106 | + EOF |
| 107 | + cd tap |
| 108 | + git config user.name "github-actions[bot]" |
| 109 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 110 | + git add . |
| 111 | + git commit -m "Update Wirdi to ${VERSION}" |
| 112 | + git push |
0 commit comments