File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Update with new release
2+ on :
3+ repository_dispatch :
4+ types : [on-release]
5+ permissions :
6+ contents : write
7+ jobs :
8+ update-formula :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : find URLs of macOS assets
12+ shell : python
13+ run : |
14+ import json
15+ envFile = open('${{ github.env }}', 'a')
16+ release = json.loads('''${{ toJSON(github.event.client_payload.release) }}''')
17+ for asset in release['assets']:
18+ artifactName = asset['name']
19+ if 'macOS-intel' in artifactName:
20+ envFile.write(f"INTEL_URL={asset['browser_download_url']}\n")
21+ elif 'macOS-arm' in artifactName:
22+ envFile.write(f"ARM_URL={asset['browser_download_url']}\n")
23+
24+ - uses : actions/checkout@v4
25+ - name : update formula with new version and asset hashes
26+ run : |
27+ tag="${{ github.event.client_payload.release.tag_name }}"
28+ intelHash=$(curl -L "$INTEL_URL" | sha256sum | cut -d ' ' -f 1)
29+ armHash=$( curl -L "$ARM_URL" | sha256sum | cut -d ' ' -f 1)
30+ sed -E -i \
31+ -e "s/version \".+/version \"$tag\"/" \
32+ -e "s/intel: \"\\w+\"/intel: \"$intelHash\"/" \
33+ -e "s/arm: \"\\w+\"/arm: \"$armHash\"/" \
34+ Casks/vcmi.rb
35+
36+ git config user.name "github-actions[bot]"
37+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+ git add .
39+ git commit -m "$tag"
40+ git push
You can’t perform that action at this time.
0 commit comments