4
4
tags :
5
5
- " v*"
6
6
7
+ permissions :
8
+ contents : write
9
+ packages : write
10
+
7
11
jobs :
8
12
build :
9
13
strategy :
23
27
os : windows-latest
24
28
runs-on : ${{ matrix.os }}
25
29
steps :
30
+ - name : Clean existing tags
31
+ run : rm -rf .git/refs/tags/
32
+
26
33
- uses : actions/checkout@v3
27
34
with :
28
35
fetch-depth : 0
74
81
needs : build
75
82
runs-on : ubuntu-latest
76
83
steps :
84
+ - name : Clean existing tags
85
+ run : rm -rf .git/refs/tags/
86
+
77
87
- uses : actions/checkout@v3
78
88
with :
79
89
fetch-depth : 0
86
96
mv */yek-*.tar.gz ./
87
97
88
98
- name : Update Formula
99
+ env :
100
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
89
101
run : |
90
102
# Get version from tag
91
103
VERSION=${GITHUB_REF#refs/tags/v}
@@ -100,19 +112,26 @@ jobs:
100
112
sed -i "/url \".*yek-${target}.tar.gz\"/{n;s/sha256 \".*\"/sha256 \"${sha}\"/;}" Formula/yek.rb
101
113
done
102
114
103
- # Configure git
104
- git config --local user.email "github-actions[bot]@users.noreply.github.com"
105
- git config --local user.name "github-actions[bot]"
115
+ # Configure git with token-based auth
116
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
117
+ git config --global user.name "github-actions[bot]"
118
+ git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
106
119
107
- # Commit and push Formula updates
120
+ # Commit and push changes
108
121
git add Formula/yek.rb
109
- git commit -m " chore: update formula for v ${VERSION}"
110
- git push origin HEAD
122
+ git commit -m ' chore: update formula for release ${VERSION}'
123
+ git push origin HEAD:main
111
124
112
- - name : Create GitHub Release
125
+ - name : Create Release
113
126
uses : softprops/action-gh-release@v1
114
127
with :
115
- files : |
116
- yek-*.tar.gz
128
+ files : yek-*.tar.gz
129
+ generate_release_notes : true
117
130
env :
118
131
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
132
+
133
+ - name : Cleanup tags
134
+ run : |
135
+ git fetch --prune --prune-tags
136
+ git tag -l | xargs -r git tag -d
137
+ git fetch --tags
0 commit comments