diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 1c3baa6e8..a9d13d200 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -27,41 +27,85 @@ jobs: args: release --release-notes=CHANGELOG.md env: GITHUB_TOKEN: ${{secrets.UPLOAD_GITHUB_TOKEN}} - - name: Bump homebrew-core formula - uses: mislav/bump-homebrew-formula-action@v1 - 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 documentation site - if: "!contains(github.ref, '-')" # skip prereleases uses: actions/checkout@v2 with: repository: github/cli.github.com path: site fetch-depth: 0 token: ${{secrets.SITE_GITHUB_TOKEN}} - - name: Publish documentation site - if: "!contains(github.ref, '-')" # skip prereleases + - name: Update site man pages env: GIT_COMMITTER_NAME: cli automation GIT_AUTHOR_NAME: cli automation GIT_COMMITTER_EMAIL: noreply@github.com GIT_AUTHOR_EMAIL: noreply@github.com - run: make site-publish + run: make site-bump - name: Move project cards - if: "!contains(github.ref, '-')" # skip prereleases + continue-on-error: true env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} PENDING_COLUMN: 8189733 DONE_COLUMN: 7110130 run: | - curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 - api() { bin/hub api -H 'accept: application/vnd.github.inertia-preview+json' "$@"; } + api() { gh api -H 'accept: application/vnd.github.inertia-preview+json' "$@"; } + api-write() { [[ $GITHUB_REF == *-* ]] && echo "skipping: api $*" || api "$@"; } cards=$(api projects/columns/$PENDING_COLUMN/cards | jq ".[].id") - for card in $cards; do api projects/columns/cards/$card/moves --field position=top --field column_id=$DONE_COLUMN; done + for card in $cards; do + api-write projects/columns/cards/$card/moves -f position=top -F column_id=$DONE_COLUMN + done + + - name: Install packaging dependencies + run: sudo apt-get install -y createrepo rpm reprepro + - name: Set up GPG + run: | + gpg --import --no-tty --batch --yes < script/pubkey.asc + echo "${{secrets.GPG_KEY}}" | base64 -d | gpg --import --no-tty --batch --yes + echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf + gpg-connect-agent RELOADAGENT /bye + echo "${{secrets.GPG_PASSPHRASE}}" | /usr/lib/gnupg2/gpg-preset-passphrase --preset 867DAD5051270B843EF54F6186FA10E3A1D22DC5 + - name: Sign RPMs + run: | + cp script/rpmmacros ~/.rpmmacros + rpmsign --addsign dist/*.rpm + - name: Run createrepo + run: | + mkdir -p site/packages/rpm + cp dist/*.rpm site/packages/rpm/ + createrepo site/packages/rpm + pushd site/packages/rpm + gpg --yes --detach-sign --armor repodata/repomd.xml + popd + - name: Run reprepro + env: + RELEASES: "focal stable" + run: | + mkdir -p upload + for release in $RELEASES; do + for file in dist/*.deb; do + reprepro --confdir="+b/script" includedeb "$release" "$file" + done + done + cp -a dists/ pool/ upload/ + mkdir -p site/packages + cp -a upload/* site/packages/ + - name: Publish site + env: + GIT_COMMITTER_NAME: cli automation + GIT_AUTHOR_NAME: cli automation + GIT_COMMITTER_EMAIL: noreply@github.com + GIT_AUTHOR_EMAIL: noreply@github.com + working-directory: ./site + run: | + git add packages + git commit -m "Add rpm and deb packages for ${GITHUB_REF#refs/tags/}" + if [[ $GITHUB_REF == *-* ]]; then + git log --oneline @{upstream}.. + git diff --name-status @{upstream}.. + else + git push + fi + msi: needs: goreleaser runs-on: windows-latest @@ -72,8 +116,7 @@ jobs: id: download_exe shell: bash run: | - curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 - bin/hub release download "${GITHUB_REF#refs/tags/}" -i '*windows_amd64*.zip' + hub release download "${GITHUB_REF#refs/tags/}" -i '*windows_amd64*.zip' printf "::set-output name=zip::%s\n" *.zip unzip -o *.zip && rm -v *.zip env: @@ -106,6 +149,14 @@ jobs: -Executable "${{ steps.buildmsi.outputs.msi }}" - name: Upload MSI shell: bash - run: bin/hub release edit "${GITHUB_REF#refs/tags/}" -m "" -a "${{ steps.buildmsi.outputs.msi }}" + run: hub release edit "${GITHUB_REF#refs/tags/}" -m "" --draft=false -a "${{ steps.buildmsi.outputs.msi }}" env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Bump homebrew-core formula + uses: mislav/bump-homebrew-formula-action@v1 + 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 }} diff --git a/.goreleaser.yml b/.goreleaser.yml index fa6883834..e3f047c19 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,6 +2,7 @@ project_name: gh release: prerelease: auto + draft: true # we only publish after the Windows MSI gets uploaded before: hooks: @@ -49,32 +50,6 @@ archives: files: - LICENSE -brews: - - name: gh - ids: [nix] - github: - owner: github - name: homebrew-gh - skip_upload: auto - description: GitHub CLI - homepage: https://github.com/cli/cli - folder: Formula - custom_block: | - head do - url "https://github.com/cli/cli.git", :branch => "trunk" - depends_on "go" - end - install: | - system "make", "bin/gh", "manpages" if build.head? - bin.install "bin/gh" - man1.install Dir["./share/man/man1/gh*.1"] - (bash_completion/"gh.sh").write `#{bin}/gh completion -s bash` - (zsh_completion/"_gh").write `#{bin}/gh completion -s zsh` - (fish_completion/"gh.fish").write `#{bin}/gh completion -s fish` - test: | - help_text = shell_output("#{bin}/gh --help") - assert_includes help_text, "Usage:" - nfpms: - license: MIT maintainer: GitHub diff --git a/Makefile b/Makefile index 0bffa784d..decf5125c 100644 --- a/Makefile +++ b/Makefile @@ -46,15 +46,14 @@ site-docs: site git -C site commit -m 'update help docs' || true .PHONY: site-docs -site-publish: site-docs +site-bump: site-docs ifndef GITHUB_REF $(error GITHUB_REF is not set) endif sed -i.bak -E 's/(assign version = )".+"/\1"$(GITHUB_REF:refs/tags/v%=%)"/' site/index.html rm -f site/index.html.bak git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html - git -C site push -.PHONY: site-publish +.PHONY: site-bump .PHONY: manpages diff --git a/README.md b/README.md index 01f18ab74..0981951a4 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,10 @@ Upgrade: sudo port selfupdate && sudo port upgrade gh ``` +### Linux + +See [Linux installation docs](/docs/install_linux.md). + ### Windows `gh` is available via [scoop][], [Chocolatey][], and as downloadable MSI. @@ -105,50 +109,6 @@ choco upgrade gh MSI installers are available for download on the [releases page][]. -### Debian/Ubuntu Linux - -Install and upgrade: - -1. Download the `.deb` file from the [releases page][]; -2. Install the downloaded file: `sudo apt install ./gh_*_linux_amd64.deb` - -### Fedora Linux - -Install and upgrade: - -1. Download the `.rpm` file from the [releases page][]; -2. Install the downloaded file: `sudo dnf install gh_*_linux_amd64.rpm` - -### Centos Linux - -Install and upgrade: - -1. Download the `.rpm` file from the [releases page][]; -2. Install the downloaded file: `sudo yum localinstall gh_*_linux_amd64.rpm` - -### openSUSE/SUSE Linux - -Install and upgrade: - -1. Download the `.rpm` file from the [releases page][]; -2. Install the downloaded file: `sudo zypper in gh_*_linux_amd64.rpm` - -### Arch Linux - -Arch Linux users can install from the [community repo][arch linux repo]: - -```bash -pacman -S github-cli -``` - -### Android - -Android users can install via Termux: - -```bash -pkg install gh -``` - ### Other platforms Download packaged binaries from the [releases page][]. @@ -157,6 +117,7 @@ Download packaged binaries from the [releases page][]. See here on how to [build GitHub CLI from source][build from source]. + [official docs]: https://cli.github.com/manual [scoop]: https://scoop.sh [Chocolatey]: https://chocolatey.org @@ -164,5 +125,4 @@ See here on how to [build GitHub CLI from source][build from source]. [hub]: https://github.com/github/hub [contributing page]: https://github.com/cli/cli/blob/trunk/.github/CONTRIBUTING.md [gh-vs-hub]: /docs/gh-vs-hub.md -[arch linux repo]: https://www.archlinux.org/packages/community/x86_64/github-cli [build from source]: /docs/source.md diff --git a/docs/install_linux.md b/docs/install_linux.md new file mode 100644 index 000000000..93e9f3efd --- /dev/null +++ b/docs/install_linux.md @@ -0,0 +1,83 @@ +# Installing gh on Linux + +Packages downloaded from https://cli.github.com or from https://github.com/cli/cli/releases +are considered official binaries. We focus on a couple of popular Linux distros and +the following CPU architectures: `386`, `amd64`, `arm64`. + +Other sources for installation are community-maintained and thus might lag behind +our release schedule. + +## Official sources + +### Debian, Ubuntu 20.04 Linux (apt) + +Install: + +```bash +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 +sudo apt-add-repository -u https://cli.github.com/packages +sudo apt install gh +``` + +Upgrade: + +```bash +sudo apt update +sudo apt install gh +``` + +### Fedora, Centos, Red Hat Linux (dnf) + +Install: + +```bash +sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo +sudo dnf install gh +``` + +Upgrade: + +```bash +sudo dnf install gh +``` + +### openSUSE/SUSE Linux (zypper) + +It's possible that https://cli.github.com/packages/rpm/gh-cli.repo will work with zypper, but +this hasn't been tested. + +## Manual installation + +* [Download release binaries][releases page] that match your platform; or +* [Build from source](./source.md). + +### openSUSE/SUSE Linux (zypper) + +Install and upgrade: + +1. Download the `.rpm` file from the [releases page][]; +2. Install the downloaded file: `sudo zypper in gh_*_linux_amd64.rpm` + +## Community-supported methods + +Our team does do not directly maintain the following packages or repositories. + +### Arch Linux + +Arch Linux users can install from the [community repo][arch linux repo]: + +```bash +pacman -S github-cli +``` + +### Android + +Android users can install via Termux: + +```bash +pkg install gh +``` + + +[releases page]: https://github.com/cli/cli/releases/latest +[arch linux repo]: https://www.archlinux.org/packages/community/x86_64/github-cli diff --git a/script/distributions b/script/distributions new file mode 100644 index 000000000..67536e4c2 --- /dev/null +++ b/script/distributions @@ -0,0 +1,16 @@ +Origin: gh +Label: gh +Codename: stable +Architectures: i386 amd64 arm64 +Components: main +Description: The GitHub CLI - debian stable repo +SignWith: C99B11DEB97541F0 + +Origin: gh +Label: gh +Codename: focal +Architectures: i386 amd64 arm64 +Components: main +Description: The GitHub CLI - ubuntu focal repo +SignWith: C99B11DEB97541F0 +DebOverride: override.focal diff --git a/script/override.focal b/script/override.focal new file mode 100644 index 000000000..89ab311a7 --- /dev/null +++ b/script/override.focal @@ -0,0 +1,2 @@ +gh Priority optional +gh Section Development diff --git a/script/pubkey.asc b/script/pubkey.asc new file mode 100644 index 000000000..9c313b43d --- /dev/null +++ b/script/pubkey.asc @@ -0,0 +1,41 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQGNBF9PzXUBDADjf/5plZnxldgufVJUC0xpwITJHB3iUvpTwYEgBaOi7WE+JkHb ++SN+2PFAumVftvOiCrt9TnrXDeUDGMsfiUa0zXsaU8pC1IcmnbYCjZqfWOmBUGoR +iGrgZxSnXQuJOIsK5R8ST9G6v7BCKTgBnTmjIeCLCEOg0GU0avrBnmszOUjDabBl +tvm/KC1lSsTfQjrn3j7LGbyVfTZ/nhIHnVUOjU4NcY9hd5xXydF0wpZ0pr28dcHI +O5X9YZSq+w8bNlGBQMa/RhGmRBIMAEKeoLFh6q/CuToe/5x8xgowJZDkSNjVmaeR +Acbdyhn2FmLyF/jFNXZ1DveX933N0MjQ/NCGgxpKbVVG+5BRSUA3Z53yvdzC61kO +8r88ZEXli4uBCNSRGcpjsS+EyV8ydMxC4uhRrbaa8b3xI0yHS9/VJ3+1vUuo4vxZ +sgbsmzErGOfyRaaF6SMJcQKf67Xk2whuDNQvRCwA8w7ZAK+XtyJ1M39fgDjRLVu6 +LK2A64jDiKPrOU0AEQEAAbQfTmF0ZSBTbWl0aCA8dmlsbWlibUBnaXRodWIuY29t +PokB1AQTAQoAPhYhBCyjIFbtIGy4H0SoysmbEd65dUHwBQJfT811AhsDBQkDwmcA +BQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEMmbEd65dUHwdWQL/1ztvcwtZUdv +c4XgwAU5DbGWxuVTAhMj+Y0o8Es3EZot6Ck9jhKUVHSF101Bbs0Nl1iOupr5P3yE +cKgsK5hB+g0Y503DsNjz3i6OyWuHVeIWmk9pXQF/ly3VOgj0atJwiR8RV79/iw+i +zcDkbKQ++3bIgLDVQ/b/EwJRZnxb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t6Zx +9CA1CUPJ9QFHHbxMufhW/0Fdhg4cFis6gC9TK8CyjRyURAXGAEUWxGbtUV3z8k5+ +Vu6z/RNHAjcuCzwm1FgX6EaAQt14hI9DqX8YPVE+c6rhSTVuQcnvvIMRmmnirs9q +XyOoWgNBDdBsEyusOg04YWu+22nfmszrXDq4QUMkIfjeMoM/bYsF6D23ZTD4imZj +LiZe/dWok6xgMOwwBhrYP71qORwChebooVX6SylkMnfT2xp/qIeAidNSioYC2fIp +ue1p4NJ+4UaLLniQAlJ8TNoYoZ+UZDIftRYCfV+U1V9mqZtWZ9Qeuv8p6iboCVag +QomPPf2XCc2VlhOraWGGC7afWIUnEz9srg8OR9IzrITGtSF7SMHB/dB2hL/tFyFs +thQyULWTJXRidPWVyWWqegyubCbY0cY= +=ki4q +-----END PGP PUBLIC KEY BLOCK----- diff --git a/script/rpmmacros b/script/rpmmacros new file mode 100644 index 000000000..fdfb48a29 --- /dev/null +++ b/script/rpmmacros @@ -0,0 +1 @@ +%_gpg_name Nate Smith