-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 2.68 KB
/
update_version_markers-extractor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Update MarkersExtractor Formula
on:
workflow_dispatch:
jobs:
update_formula:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest release info
id: get_release
run: |
latest_release_tag=$(curl -sSL https://api.github.com/repos/TheAcharya/MarkersExtractor/releases/latest | jq -r '.tag_name | ltrimstr("v")')
latest_release_url=$(curl -sSL https://api.github.com/repos/TheAcharya/MarkersExtractor/releases/latest | jq -r '.assets[] | select(.name | endswith(".pkg")) | .browser_download_url')
echo "Latest release tag: $latest_release_tag"
echo "Latest release URL: $latest_release_url"
- name: Update formula file
run: |
tag=$(curl -sSL https://api.github.com/repos/TheAcharya/MarkersExtractor/releases/latest | jq -r '.tag_name | ltrimstr("v")')
url=$(curl -sSL https://api.github.com/repos/TheAcharya/MarkersExtractor/releases/latest | jq -r '.assets[] | select(.name | endswith(".pkg")) | .browser_download_url')
sha256=$(curl -sSL $url | shasum -a 256 | awk '{print $1}')
curr_tag=$(grep -oP '(?<=version ")[^"]*' Casks/markers-extractor.rb)
if [ "$curr_tag" != "$tag" ]; then
rm Casks/markers-extractor.rb
echo "Updating formula file with version $tag and sha256 $sha256"
echo 'cask "markers-extractor" do' > Casks/markers-extractor.rb
echo " version \"$tag\"" >> Casks/markers-extractor.rb
echo " sha256 \"$sha256\"" >> Casks/markers-extractor.rb
echo " url \"https://github.com/TheAcharya/MarkersExtractor/releases/download/$tag/markers-extractor-cli-$tag.pkg\"" >> Casks/markers-extractor.rb
echo ' name "MarkersExtractor"' >> Casks/markers-extractor.rb
echo ' desc "Extract Markers from Final Cut Pro FCPXML"' >> Casks/markers-extractor.rb
echo ' homepage "https://github.com/TheAcharya/MarkersExtractor"' >> Casks/markers-extractor.rb
echo '' >> Casks/markers-extractor.rb
echo " pkg \"markers-extractor-cli-$tag.pkg\"" >> Casks/markers-extractor.rb
echo '' >> Casks/markers-extractor.rb
echo ' uninstall pkgutil: "co.theacharya.MarkersExtractor"' >> Casks/markers-extractor.rb
echo 'end' >> Casks/markers-extractor.rb
echo "commiting update"
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Updated markers-extractor formula to version ${{ steps.get_release.outputs.tag }}"
git push
else
echo "The file is in the tag $tag, skipping update"
fi