Skip to content

Commit 395f670

Browse files
committed
Switch to goxc
1 parent 333f492 commit 395f670

File tree

9 files changed

+151
-65
lines changed

9 files changed

+151
-65
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ dist/
1111
profile.cov
1212
profile.out
1313
.vendor
14+
.goxc.local.json

.goxc.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"AppName": "scw",
3+
"ArtifactsDest": "dist",
4+
"OutPath": "{{.Dest}}{{.PS}}{{.Version}}{{.PS}}{{.Os}}_{{.Arch}}{{.PS}}{{.ExeName}}{{.Ext}}",
5+
"Tasks": [
6+
"default",
7+
"deb-source",
8+
"downloads-page"
9+
],
10+
"TasksExclude": [
11+
"go-test",
12+
"bintray",
13+
"go-vet",
14+
"rmbin",
15+
"publish-github"
16+
],
17+
"BuildConstraints": "darwin linux windows freebsd netbsd",
18+
"ResourcesExclude": "*.go .goxc-temp",
19+
"MainDirsExclude": "vendor,Godeps,testdata",
20+
"PackageVersion": "v1.4.0-rc1",
21+
"TaskSettings": {
22+
"bintray": {
23+
"downloadspage": "bintray.md",
24+
"package": "scaleway-cli",
25+
"repository": "utils",
26+
"subject": "scaleway"
27+
},
28+
"codesign": {
29+
"id": "scaleway-cli"
30+
},
31+
"downloads-page": {
32+
"filename": "index.md",
33+
"templateFile": "downloads.tpl"
34+
},
35+
"publish-github": {
36+
"owner": "scaleway",
37+
"prerelease": false,
38+
"repository": "scaleway-cli"
39+
}
40+
},
41+
"ConfigVersion": "0.9",
42+
"BuildSettings": {
43+
"LdFlags": "-s",
44+
"LdFlagsXVars": {
45+
"TimeNow": "main.BUILD_DATE",
46+
"Version": "main.VERSION"
47+
}
48+
}
49+
}

Dockerfile

Lines changed: 0 additions & 38 deletions
This file was deleted.

Makefile

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,23 +83,41 @@ $(FMT_LIST): %_fmt:
8383
$(GOFMT) ./$*
8484

8585

86-
cross: pkg/scwversion/version.go
87-
docker build -t $(BUILDER) .
88-
@docker rm scaleway-cli-builer 2>/dev/null || true
89-
mkdir -p dist
90-
docker run --name=$(BUILDER) $(BUILDER) tar -cf - /etc/ssl > dist/ssl.tar
91-
docker cp $(BUILDER):/go/bin tmp
92-
docker rm $(BUILDER)
93-
touch tmp/bin/*
94-
mv tmp/bin/* dist/
95-
rm -rf tmp
86+
release-docker:
87+
docker push scaleway/cli
9688

9789

98-
release-docker:
90+
goxc: pkg/scwversion/version.go
91+
rm -rf dist/$(shell cat .goxc.json| jq -r .PackageVersion)
92+
mkdir -p dist/$(shell cat .goxc.json| jq -r .PackageVersion)
93+
ln -s -f $(shell cat .goxc.json| jq -r .PackageVersion) dist/latest
94+
95+
goxc
96+
97+
mv dist/latest/darwin_386/scw dist/latest/scw-Darwin-i386
98+
mv dist/latest/darwin_amd64/scw dist/latest/scw-Darwin-amd64
99+
mv dist/latest/freebsd_386/scw dist/latest/scw-Freebsd-i386
100+
mv dist/latest/freebsd_amd64/scw dist/latest/scw-Freebsd-x86_64
101+
mv dist/latest/freebsd_arm/scw dist/latest/scw-Freebsd-arm
102+
mv dist/latest/linux_386/scw dist/latest/scw-Linux-i386
103+
mv dist/latest/linux_amd64/scw dist/latest/scw-Linux-x86_64
104+
mv dist/latest/linux_arm/scw dist/latest/scw-Linux-arm
105+
mv dist/latest/netbsd_386/scw dist/latest/scw-Netbsd-i386
106+
mv dist/latest/netbsd_amd64/scw dist/latest/scw-Netbsd-x86_64
107+
mv dist/latest/netbsd_arm/scw dist/latest/scw-Netbsd-arm
108+
mv dist/latest/windows_386/scw.exe dist/latest/scw-Windows-i386.exe
109+
mv dist/latest/windows_amd64/scw.exe dist/latest/scw-Windows-x86_64.exe
110+
111+
cp dist/latest/scw-Linux-arm dist/latest/scw-Linux-armv7l
112+
113+
@rmdir dist/latest/* || true
114+
115+
docker run --rm golang tar -cf - /etc/ssl > dist/latest/ssl.tar
99116
docker build -t scaleway/cli dist
100117
docker run scaleway/cli version
101118
docker tag -f scaleway/cli:latest scaleway/cli:$(TAG)
102-
@echo " Now you can run 'docker push scaleway/cli'"
119+
120+
@echo "Now you can run 'goxc publish-github', 'goxc bintray' and 'make release-docker'"
103121

104122

105123
packages:

README.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,59 @@ For node version, check out [scaleway-cli-node](https://github.com/moul/scaleway
6565

6666
## Setup
6767

68-
To install Scaleway CLI 1.3.0, run the following commands:
68+
We recommend to use the latest version, using:
69+
70+
```shell
71+
go get -u github.com/scaleway/scaleway-cli/cmd/scw
72+
```
73+
74+
or
75+
76+
```shell
77+
brew install "https://raw.githubusercontent.com/scaleway/scaleway-cli/master/contrib/builder/homebrew/scw.rb" --HEAD
78+
```
79+
80+
---
81+
82+
To install a release, checkout the [latest release page](https://github.com/scaleway/scaleway-cli/releases/latest).
83+
84+
Install the latest stable release on Mac OS X using [Homebrew](http://brew.sh):
6985

7086
```bash
71-
curl -L https://github.com/scaleway/scaleway-cli/releases/download/v1.3.0/scw-`uname -s`-`uname -m` > /usr/local/bin/scw
72-
chmod +x /usr/local/bin/scw
87+
brew install scw
7388
```
7489

75-
To install Scaleway CLI master git, run the following command:
90+
Install the latest stable release on Mac OS X manually:
7691

7792
```bash
78-
go get github.com/scaleway/scaleway-cli/...
93+
# prepare for forst install and upgrade
94+
mkdir -p /usr/local/bin
95+
mv /usr/local/bin/scw /tmp/scw.old
96+
97+
# get latest release
98+
export VERSION=v1.4.0-rc1
99+
wget "https://github.com/scaleway/scaleway-cli/releases/download/${VERSION}/scw_${VERSION}_darwin_amd64.zip" -O /tmp/scw.zip
100+
unzip /tmp/scw.zip \*/scw -d /tmp
101+
mv /tmp/scw_*/scw /usr/local/bin
102+
rm -rf /tmp/scw.zip /tmp/scw_*_darwin_amd64
103+
104+
# test
105+
scw version
79106
```
80107

108+
Install the latest release on Linux:
109+
110+
```bash
111+
# get latest release
112+
export ARCH=amd64 # can be 'i386', 'amd64' or 'arm'
113+
wget "https://github.com/scaleway/scaleway-cli/releases/download/v1.4.0-rc1/scw_v1.4.0-rc1_${ARCH}.deb" -O /tmp/scw.deb
114+
dpkg -i /tmp/scw.deb && rm -f /tmp/scw.deb
115+
116+
# test
117+
scw version
118+
```
119+
120+
81121
### Requirements
82122

83123
By using the [static-compiled release binaries](https://github.com/scaleway/scaleway-cli/releases/latest), you only needs to have one of the following platform+architecture :
@@ -1056,6 +1096,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address'
10561096
* Sorting cache search by Levenshtein distance ([#87](https://github.com/scaleway/scaleway-cli/issues/87))
10571097
* Allow set up api endpoint using the environment variable $scaleway_api_endpoint
10581098
* Use TLS and verify can now be disabled using `SCALEWAY_TLSVERIFY=0` env var ([#115](https://github.com/scaleway/scaleway-cli/issues/115))
1099+
* Switched to `goxc` for releases
10591100

10601101
#### Fixes
10611102

contrib/builder/homebrew/scw.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
class Scw < Formula
44
desc "Manage BareMetal Servers from Command Line (as easily as with Docker)"
55
homepage "https://github.com/scaleway/scaleway-cli"
6-
url "https://github.com/scaleway/scaleway-cli/archive/v1.3.0.tar.gz"
7-
sha256 "b02ed007f831b9ffd79be0b670c6c1bfa59a87ba87ac54dea48005cfb305f5c7"
6+
url "https://github.com/scaleway/scaleway-cli/archive/v1.4.0-rc1.tar.gz"
7+
sha256 "2356191ef6c6e4f541aa2a516ec710f964b914e2976098174f68009d17aa110d"
88

99
head "https://github.com/scaleway/scaleway-cli.git"
1010

@@ -19,7 +19,7 @@ def install
1919
ln_s buildpath, buildpath/"src/github.com/scaleway/scaleway-cli"
2020
Language::Go.stage_deps resources, buildpath/"src"
2121

22-
system "go", "build", "-o", "scw", "."
22+
system "go", "build", "-o", "scw", "./cmd/scw"
2323
bin.install "scw"
2424

2525
bash_completion.install "contrib/completion/bash/scw"

dist/.dockerignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
scw-Darwin-*
2-
scw-Windows-*
3-
scw-Freebsd-*
4-
scw-Linux-arm*
5-
scw-Linux-x86*
1+
*.zip
2+
*.tar.gz
3+
*.deb
64
Dockerfile
75
.dockerignore

dist/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM scratch
22
MAINTAINER Scaleway <[email protected]> (@scaleway)
3-
ADD ssl.tar /
4-
COPY scw-Linux-i386 /bin/scw
3+
ADD latest/ssl.tar /
4+
COPY latest/scw-Linux-i386 /bin/scw
55
VOLUME /root/
66
ENTRYPOINT ["/bin/scw"]

downloads.tpl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: default
3+
title: Downloads
4+
---
5+
6+
NOTE: You can get latest version of scaleway-cli using `go get -u github.com/scaleway/scaleway-cli/cmd/scw`.
7+
8+
{{.AppName}} downloads (version {{.Version}})
9+
10+
{{range $k, $v := .Categories}}### {{$k}}
11+
12+
{{range $v}} * [{{.Text}}]({{.RelativeLink}})
13+
{{end}}
14+
{{end}}
15+
16+
---
17+
{{.ExtraVars.footer}}

0 commit comments

Comments
 (0)