From 0a17259e3c3afa4970a019c763a73ead2b0b99bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 1 Oct 2020 19:08:31 +0200 Subject: [PATCH] Bump scoop bucket manually on release Goreleaser can no longer do this for us since we're always creating a draft release initially. --- .github/workflows/releases.yml | 23 +++++++++++++++++++++++ .goreleaser.yml | 12 ------------ script/scoop-gen | 30 ++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 12 deletions(-) create mode 100755 script/scoop-gen diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index d9d68806f..51cee4d3e 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -160,3 +160,26 @@ jobs: 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: + GIT_COMMITTER_NAME: cli automation + GIT_AUTHOR_NAME: cli automation + GIT_COMMITTER_EMAIL: noreply@github.com + GIT_AUTHOR_EMAIL: noreply@github.com \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index dc93cf6b4..548a3e44a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -63,15 +63,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: vilmibm@github.com - homepage: https://github.com/cli/cli - skip_upload: auto - description: GitHub CLI - license: MIT diff --git a/script/scoop-gen b/script/scoop-gen new file mode 100755 index 000000000..e123e1b82 --- /dev/null +++ b/script/scoop-gen @@ -0,0 +1,30 @@ +#!/bin/bash +# Usage: cat checksums.txt | script/scoop-gen +set -e + +tagname="${1?}" +version="${tagname#v}" +urlprefix="https://github.com/cli/cli/releases/download/$tagname/" +jsonfile="${2?}" + +jq_args=( + --arg version "$version" + $(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 = $win32file | + .architecture."32bit".hash = $win32hash | + .architecture."64bit".url = $win64file | + .architecture."64bit".hash = $win64hash +' "${jq_args[@]}" --indent 4 "$jsonfile" > "$jsonfile"~