X Tutup
Skip to content

Commit 0a17259

Browse files
committed
Bump scoop bucket manually on release
Goreleaser can no longer do this for us since we're always creating a draft release initially.
1 parent 091d550 commit 0a17259

File tree

3 files changed

+53
-12
lines changed

3 files changed

+53
-12
lines changed

.github/workflows/releases.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,26 @@ jobs:
160160
download-url: https://github.com/cli/cli.git
161161
env:
162162
COMMITTER_TOKEN: ${{ secrets.UPLOAD_GITHUB_TOKEN }}
163+
- name: Checkout scoop bucket
164+
uses: actions/checkout@v2
165+
with:
166+
repository: cli/scoop-gh
167+
path: scoop-gh
168+
fetch-depth: 0
169+
token: ${{secrets.UPLOAD_GITHUB_TOKEN}}
170+
- name: Bump scoop bucket
171+
shell: bash
172+
run: |
173+
hub release download "${GITHUB_REF#refs/tags/}" -i '*_checksums.txt'
174+
script/scoop-gen "${GITHUB_REF#refs/tags/}" ./scoop-gh/gh.json < *_checksums.txt
175+
git -C ./scoop-gh commit -m "gh ${GITHUB_REF#refs/tags/}" gh.json
176+
if [[ $GITHUB_REF == *-* ]]; then
177+
git -C ./scoop-gh show -m
178+
else
179+
git -C ./scoop-gh push
180+
fi
181+
env:
182+
GIT_COMMITTER_NAME: cli automation
183+
GIT_AUTHOR_NAME: cli automation
184+
GIT_COMMITTER_EMAIL: noreply@github.com
185+
GIT_AUTHOR_EMAIL: noreply@github.com

.goreleaser.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,3 @@ nfpms:
6363
- rpm
6464
files:
6565
"./share/man/man1/gh*.1": "/usr/share/man/man1"
66-
67-
scoop:
68-
bucket:
69-
owner: cli
70-
name: scoop-gh
71-
commit_author:
72-
name: vilmibm
73-
email: vilmibm@github.com
74-
homepage: https://github.com/cli/cli
75-
skip_upload: auto
76-
description: GitHub CLI
77-
license: MIT

script/scoop-gen

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Usage: cat checksums.txt | script/scoop-gen <version> <json-file>
3+
set -e
4+
5+
tagname="${1?}"
6+
version="${tagname#v}"
7+
urlprefix="https://github.com/cli/cli/releases/download/$tagname/"
8+
jsonfile="${2?}"
9+
10+
jq_args=(
11+
--arg version "$version"
12+
$(cat | awk '
13+
/windows_386/ {
14+
printf "--arg win32hash \"%s\"\n", $1
15+
printf "--arg win32file \"%s\"\n", $2
16+
}
17+
/windows_amd64/ {
18+
printf "--arg win64hash \"%s\"\n", $1
19+
printf "--arg win64file \"%s\"\n", $2
20+
}
21+
')
22+
)
23+
24+
jq '
25+
.version = $version |
26+
.architecture."32bit".url = $win32file |
27+
.architecture."32bit".hash = $win32hash |
28+
.architecture."64bit".url = $win64file |
29+
.architecture."64bit".hash = $win64hash
30+
' "${jq_args[@]}" --indent 4 "$jsonfile" > "$jsonfile"~

0 commit comments

Comments
 (0)
X Tutup