-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cli#2056 from cli/scoop
Fix updating scoop bucket, homebrew-core formula on release
- Loading branch information
Showing
3 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,12 +21,12 @@ jobs: | |
git fetch --unshallow | ||
script/changelog | tee CHANGELOG.md | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v1 | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --release-notes=CHANGELOG.md | ||
env: | ||
GITHUB_TOKEN: ${{secrets.UPLOAD_GITHUB_TOKEN}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Checkout documentation site | ||
uses: actions/checkout@v2 | ||
with: | ||
|
@@ -157,6 +157,29 @@ jobs: | |
if: "!contains(github.ref, '-')" # skip prereleases | ||
with: | ||
formula-name: gh | ||
download-url: https://github.com/cli/cli.git | ||
env: | ||
COMMITTER_TOKEN: ${{ secrets.UPLOAD_GITHUB_TOKEN }} | ||
- name: Checkout scoop bucket | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: cli/scoop-gh | ||
path: scoop-gh | ||
fetch-depth: 0 | ||
token: ${{secrets.UPLOAD_GITHUB_TOKEN}} | ||
- name: Bump scoop bucket | ||
shell: bash | ||
run: | | ||
hub release download "${GITHUB_REF#refs/tags/}" -i '*_checksums.txt' | ||
script/scoop-gen "${GITHUB_REF#refs/tags/}" ./scoop-gh/gh.json < *_checksums.txt | ||
git -C ./scoop-gh commit -m "gh ${GITHUB_REF#refs/tags/}" gh.json | ||
if [[ $GITHUB_REF == *-* ]]; then | ||
git -C ./scoop-gh show -m | ||
else | ||
git -C ./scoop-gh push | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
GIT_COMMITTER_NAME: cli automation | ||
GIT_AUTHOR_NAME: cli automation | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
GIT_AUTHOR_EMAIL: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ project_name: gh | |
release: | ||
prerelease: auto | ||
draft: true # we only publish after the Windows MSI gets uploaded | ||
name_template: "GitHub CLI {{.Version}}" | ||
|
||
before: | ||
hooks: | ||
|
@@ -63,15 +64,3 @@ nfpms: | |
- rpm | ||
files: | ||
"./share/man/man1/gh*.1": "/usr/share/man/man1" | ||
|
||
scoop: | ||
bucket: | ||
owner: cli | ||
name: scoop-gh | ||
commit_author: | ||
name: vilmibm | ||
email: [email protected] | ||
homepage: https://github.com/cli/cli | ||
skip_upload: auto | ||
description: GitHub CLI | ||
license: MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# Usage: cat checksums.txt | script/scoop-gen <version> <json-file> | ||
set -e | ||
|
||
tagname="${1?}" | ||
jsonfile="${2?}" | ||
|
||
jq_args=( | ||
--arg version "${tagname#v}" | ||
--arg urlprefix "https://github.com/cli/cli/releases/download/$tagname/" | ||
$(cat | awk ' | ||
/windows_386/ { | ||
printf "--arg win32hash %s\n", $1 | ||
printf "--arg win32file %s\n", $2 | ||
} | ||
/windows_amd64/ { | ||
printf "--arg win64hash %s\n", $1 | ||
printf "--arg win64file %s\n", $2 | ||
} | ||
') | ||
) | ||
|
||
jq ' | ||
.version = $version | | ||
.architecture."32bit".url = $urlprefix + $win32file | | ||
.architecture."32bit".hash = $win32hash | | ||
.architecture."64bit".url = $urlprefix + $win64file | | ||
.architecture."64bit".hash = $win64hash | ||
' "${jq_args[@]}" --indent 4 "$jsonfile" > "$jsonfile"~ | ||
|
||
mv "$jsonfile"{~,} |