1414 with :
1515 homebrew-tap : ' vetlewi/homebrew-formula'
1616 formula-name : ' xia2tree'
17- formula-path : ' xia2tree.rb'
17+ formula-path : ' Formula/ xia2tree.rb'
1818 base-branch : ' main'
1919 env :
2020 # the personal access token should have "repo" & "workflow" scopes
21- COMMITTER_TOKEN : ${{ secrets.COMMITTER_TOKEN }}
22- deploy :
23- needs : homebrew
24- runs-on : macos-latest
25- steps :
26- - uses : actions/checkout@v4
27-
28- - name : Add tap
29- run : brew tap vetlewi/formula
30-
31- - name : Update homebrew
32- run : brew update
33-
34- - name : Install via homebrew
35- run : brew install --build-bottle xia2tree
36-
37- - name : Bottle binary
38- run : brew bottle --root-url="https://github.com/vetlewi/XIA2tree/releases/download/${{ github.ref_name }}" --no-rebuild xia2tree
39-
40- - name : Rename bottle file
41- run : |
42- for f in xia2tree--*.bottle.tar.gz; do
43- new_name=$(echo "$f" | sed 's/--/-/')
44- mv "$f" "$new_name"
45- done
46-
47- - name : Upload bottle to release
48- uses : softprops/action-gh-release@v1
49- with :
50- files : ./xia2tree-*.tar.gz
51- env :
52- GITHUB_TOKEN : ${{ secrets.COMMITTER_TOKEN }}
53-
54- - name : Commit updated bottle block
55- run : |
56- # Clone the tap repo
57- brew tap vetlewi/formula
58- git clone https://x-access-token:${{ secrets.COMMITTER_TOKEN }}@github.com/vetlewi/homebrew-formula.git
59- cd homebrew-formula
60-
61- # Replace the old bottle block using Ruby logic
62- FORMULA_PATH="xia2tree.rb"
63- NEW_BOTTLE_BLOCK=$(brew bottle ./xia2tree.rb --json | jq -r '.formula.bottle | " bottle do\n root_url \"" + .root_url + "\"\n sha256 cellar: :any_skip_relocation, " + (.tags | to_entries[] | "\(.key): \"" + .value.sha256 + "\"") + "\n end"')
64-
65- # Use sed to replace old bottle block (naively here, better if you use Ruby)
66- awk '
67- BEGIN { skip = 0 }
68- /^ bottle do/, /^ end$/ { skip = 1 }
69- skip && /^ end$/ { skip = 0; next }
70- !skip { print }
71- ' "$FORMULA_PATH" > tmp.rb
72-
73- echo "$NEW_BOTTLE_BLOCK" >> tmp.rb
74- mv tmp.rb "$FORMULA_PATH"
75-
76- git config user.name "github-actions"
77- git config user.email "github-actions@github.com"
78- git add "$FORMULA_PATH"
79- git commit -m "Update bottle block for xia2tree ${{ github.ref_name }}"
80- git push origin main
21+ COMMITTER_TOKEN : ${{ secrets.COMMITTER_TOKEN }}
0 commit comments