-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
144 additions
and
0 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
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,16 @@ | ||
nfpms: | ||
- | ||
package_name: scw | ||
vendor: Scaleway | ||
homepage: https://www.scaleway.com/ | ||
description: Scaleway CLI is a tool to help you pilot your Scaleway infrastructure directly from your terminal. | ||
maintainer: Scaleway Devtools <[email protected]> | ||
license: Apache 2.0 | ||
formats: | ||
- deb | ||
deb: | ||
signature: | ||
key_file: '{{ .Env.GPG_KEY }}' | ||
key_id: F5BF26CADF6F9614 | ||
type: origin | ||
|
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 |
---|---|---|
|
@@ -80,3 +80,4 @@ blobs: | |
- glob: scw-cli-v2-version | ||
ids: | ||
- binaries | ||
|
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 @@ | ||
SHELL=bash | ||
|
||
rpm-setup: | ||
sudo dnf groupinstall "RPM Development Tools" -y | ||
sudo dnf install copr-cli -y | ||
rpmdev-setuptree | ||
sudo dnf install jq -y | ||
|
||
template-rpm-spec: require-version | ||
sed s/\%\{version_\}/${VERSION}/g specs/rpm/scaleway-cli.tmpl.spec > specs/rpm/scaleway-cli.spec | ||
RELEASE_JSON="$$(curl https://api.github.com/repos/scaleway/scaleway-cli/releases/tags/v${VERSION})"; \ | ||
DATE=$$(date -d "$$(echo $${RELEASE_JSON} | jq ."created_at" -r)" "+%a %b %d %Y") ; \ | ||
CHANGELOG="$$(echo $${RELEASE_JSON} | jq ."body" -r | grep '^*' | sed s/^\*/-/g)"; \ | ||
echo "* $${DATE} Scaleway Devtools <[email protected]> - ${VERSION}" >> specs/rpm/scaleway-cli.spec; \ | ||
echo "$${CHANGELOG}" >> specs/rpm/scaleway-cli.spec | ||
|
||
srpm-build: require-version template-rpm-spec | ||
sudo dnf builddep specs/rpm/scaleway-cli.spec -y | ||
spectool -g -R specs/rpm/scaleway-cli.spec --define "version_ ${VERSION}" | ||
rpmbuild -ba specs/rpm/scaleway-cli.spec --define "version_ ${VERSION}" | ||
|
||
rpm-build: srpm-build | ||
cd ~/rpmbuild/ | ||
rpmbuild -bs | ||
|
||
require-version: | ||
ifndef VERSION | ||
$(error VERSION is undefined) | ||
endif | ||
|
||
.PHONY: rpm-setup rpm-build srpm-build |
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,41 @@ | ||
Name: scw | ||
Version: %{version_} | ||
Release: 1%{?dist} | ||
Summary: Scaleway CLI | ||
|
||
License: Apache License 2.0 | ||
URL: https://github.com/scaleway/scaleway-cli | ||
Source0: https://github.com/scaleway/scaleway-cli/archive/refs/tags/v%{version}.tar.gz | ||
|
||
%if 0%{?suse_version} | ||
BuildRequires: go git | ||
%else | ||
BuildRequires: golang git | ||
%endif | ||
|
||
Provides: %{name} = %{version} | ||
|
||
%description | ||
Scaleway CLI | ||
|
||
%global debug_package %{nil} | ||
|
||
%prep | ||
%autosetup -n scaleway-cli-%{version} | ||
|
||
|
||
%build | ||
export CGO_ENABLED=0 | ||
LDFLAGS="-w -extldflags -static -X main.Version=%{version}" | ||
GOPROXY=direct GOOS=linux GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o %{name} cmd/scw/main.go | ||
|
||
|
||
%install | ||
install -Dpm 0755 %{name} %{buildroot}%{_bindir}/%{name} | ||
|
||
|
||
%files | ||
%{_bindir}/%{name} | ||
|
||
|
||
%changelog |