%global goipath         github.com/cli/cli
%global forgeurl        https://github.com/cli/cli
Version:                1.0.0

%gometa

Name:     gh-cli
Summary:  GitHub’s official command line tool
Release:  1%{?dist}
URL:      %{forgeurl}

License:  MIT
Source0:  %{gosource}

%global gomodulesmode      GO111MODULE=auto

BuildRequires:  git
BuildRequires:  wget
%if 0%{?fedora} > 29
BuildRequires:  compiler(go-compiler)
BuildRequires:  systemd-rpm-macros
%else
BuildRequires:  golang
%define _unitdir  /usr/lib/systemd/system
%endif

%description
gh is GitHub on the command line, and it's now available in beta. 
It brings pull requests, issues, and other GitHub concepts to the 
terminal next to where you are already working with git and your 
code.

%prep
%goprep

%build
%gobuild -o %{gobuilddir}/bin/gh ./cmd/gh

%install
mkdir -p %{buildroot}%{_bindir}
install -m 0755 -vp  %{gobuilddir}/bin/gh %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions
%{gobuilddir}/bin/gh completion --shell bash >> %{buildroot}%{_datadir}/bash-completion/completions/gh

%files
%defattr(-,root,root,-)
%{_bindir}/gh
%{_datadir}/bash-completion/completions/gh


%changelog
* Sun Sep 20 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 1.0.0-1
- upgrade to 1.0.0 upstream release

* Tue Aug 04 09:36:45 GMT 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 0.11.1-1
- upgrade to 0.11.1 upstream release

* Sun Jul 26 04:52:23 GMT 2020 Qiyu Yan <yanqiyu@fedoraproject.org> - 0.11.0-2
- rebuilt