Skip to content

Commit f5d79e4

Browse files
authored
chore: migrate to goreleaser (#1809)
1 parent 8b760c2 commit f5d79e4

File tree

10 files changed

+121
-1487
lines changed

10 files changed

+121
-1487
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Login to DockerHub Registry
18+
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: 1.17
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v2
27+
with:
28+
version: latest
29+
args: release --rm-dist
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
.vscode
33
/bin
44
node_modules
5+
6+
# Local release artifacts
7+
dist/
8+
scw-cli-v2-version

.goreleaser.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
# We generate the flag file in the before hook, so that we can use it in blobs section
5+
- sh -c "echo {{ .Version }} > scw-cli-v2-version"
6+
7+
builds:
8+
- id: binaries
9+
env:
10+
- CGO_ENABLED=0
11+
main: ./cmd/scw/main.go
12+
goos:
13+
- freebsd
14+
- linux
15+
- windows
16+
- darwin
17+
goarch:
18+
- 386
19+
- amd64
20+
- arm64
21+
ignore:
22+
- goos: darwin
23+
goarch: 386
24+
ldflags:
25+
- -X main.Version={{ .Version }}
26+
- -X main.BuildDate={{ .Date }}
27+
- -X main.GitBranch={{ .Branch }}
28+
- -X main.GitCommit={{ .ShortCommit }}
29+
30+
archives:
31+
- format: binary
32+
33+
checksum:
34+
name_template: 'SHA256SUMS'
35+
algorithm: sha256
36+
37+
changelog:
38+
use: github
39+
sort: asc
40+
filters:
41+
exclude:
42+
- '^docs:'
43+
- '^test:'
44+
45+
dockers:
46+
- image_templates:
47+
- "scaleway/cli:latest"
48+
- "scaleway/cli:{{ .Tag }}"
49+
- "scaleway/cli:{{ .Major }}"
50+
- "scaleway/cli:{{ .Major }}.{{ .Minor }}"
51+
52+
release:
53+
github:
54+
owner: scaleway
55+
name: scaleway-cli
56+
57+
# If set to auto, will mark the release as not ready for production
58+
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
59+
# If set to true, will mark the release as not ready for production.
60+
prerelease: auto
61+
draft: true
62+
name_template: "{{ .Tag }}"
63+
64+
# We deploy a flag to a bucket that will be checked regularly by the CLI in the wild to check whether a new version is available.
65+
blobs:
66+
- provider: s3
67+
endpoint: s3.fr-par.scw.cloud
68+
bucket: scw-devtools
69+
folder: "/"
70+
extra_files:
71+
- glob: scw-cli-v2-version
72+
ids:
73+
- binaries

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
Changelog moved to Release Notes in [Github Releases](https://github.com/scaleway/scaleway-cli/releases)
4+
35
## v2.4.0 (2021-10-28)
46

57
### Features

README.md

Lines changed: 9 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ Scaleway CLI is a tool to help you pilot your Scaleway infrastructure directly f
1313

1414
## With a Package Manager (Recommended)
1515

16-
A package manager allows to install and upgrade the Scaleway CLI with a single command. We recommend this installation mode for more simplicity and reliability:
17-
18-
<!-- TODO: We support a growing set of package managers to feat your preferences and your platform. Note that some package managers are maintained by our community: -->
16+
A package manager installs and upgrades the Scaleway CLI with a single command.
17+
We recommend this installation mode for more simplicity and reliability:
1918

2019
### Homebrew
2120

@@ -36,49 +35,27 @@ yay -S scaleway-cli
3635

3736
### Chocolatey
3837

39-
Install the lastest stable release on Windows using [Chocolatey](https://chocolatey.org/) ([Package](https://chocolatey.org/packages/scaleway-cli)):
38+
Install the latest stable release on Windows using [Chocolatey](https://chocolatey.org/) ([Package](https://chocolatey.org/packages/scaleway-cli)):
4039

4140
```powershell
4241
choco install scaleway-cli
4342
```
4443

45-
<!--- TODO:
46-
### Others
47-
48-
TODO: Add other package managers:
49-
- [Snap](https://snapcraft.io/)
50-
- [Apt](https://wiki.debian.org/Apt)
51-
-->
52-
5344
## Manually
5445

5546
### Released Binaries
5647

5748
We provide [static-compiled binaries](https://github.com/scaleway/scaleway-cli/releases/latest) for darwin (macOS), GNU/Linux, and Windows platforms.
5849
You just have to download the binary compatible with your platform to a directory available in your `PATH`:
5950

60-
#### Mac OS
61-
62-
```bash
63-
# Check that /usr/local/bin is in your PATH
64-
echo $PATH
65-
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
66-
67-
# Download the release from github
68-
curl -o /usr/local/bin/scw -L "https://github.com/scaleway/scaleway-cli/releases/download/v2.4.0/scw-2.4.0-darwin-x86_64"
69-
70-
# Allow executing file as program
71-
chmod +x /usr/local/bin/scw
72-
73-
# Init the CLI
74-
scw init
75-
```
76-
7751
#### Linux
7852

7953
```bash
54+
# Check out the latest release available on github <https://github.com/scaleway/scaleway-cli/releases/latest>
55+
VERSION="2.4.0"
56+
8057
# Download the release from github
81-
sudo curl -o /usr/local/bin/scw -L "https://github.com/scaleway/scaleway-cli/releases/download/v2.4.0/scw-2.4.0-linux-x86_64"
58+
sudo curl -o /usr/local/bin/scw -L "https://github.com/scaleway/scaleway-cli/releases/download/v$VERSION/scw-$VERSION-linux-x86_64"
8259

8360
# Allow executing file as program
8461
sudo chmod +x /usr/local/bin/scw
@@ -89,44 +66,15 @@ scw init
8966

9067
#### Windows
9168

92-
You can download the last release here: https://github.com/scaleway/scaleway-cli/releases/download/v2.4.0/scw-2.4.0-windows-x86_64.exe<br/>
69+
You can download the last release here: <https://github.com/scaleway/scaleway-cli/releases><br/>
9370
[This official guide](https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee537574%28v%3Doffice.14%29) explains how to add tools to your `PATH`.
9471

95-
<!-- TODO:
96-
97-
### Debian
98-
99-
First, download [the `.deb` file](https://github.com/scaleway/scaleway-cli/releases/latest) compatible with your architecture:
100-
101-
```bash
102-
export ARCH=amd64 # Can be 'amd64', 'arm', 'arm64' or 'i386'
103-
wget "https://github.com/scaleway/scaleway-cli/releases/download/v2.4.0/scw-v2.4.0-${ARCH}.deb" -O /tmp/scw.deb
104-
```
105-
106-
Then, run the installation and remove the `.deb` file:
107-
```bash
108-
dpkg -i /tmp/scw.deb && rm -f /tmp/scw.deb
109-
```
110-
-->
111-
112-
<!-- TODO:
113-
## With a Docker Image
114-
115-
### Official releases (Coming soon..)
116-
117-
For each release, we deliver a tagged image on the [Scaleway Docker Hub](https://hub.docker.com/r/scaleway/cli/tags) so can run `scw` in a sandboxed way: _Coming soon..._
118-
119-
```sh
120-
docker run scaleway/cli version
121-
```
122-
-->
123-
12472
## Docker Image
12573

12674
You can use the CLI as you would run any Docker image:
12775

12876
```sh
129-
docker run -i --rm scaleway/cli:v2.4.0
77+
docker run -i --rm scaleway/cli:latest
13078
```
13179

13280
See more in-depth information about running the CLI in Docker [here](./docs/docker.md)

cmd/scw/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
)
1515

1616
var (
17-
// Version is updated manually
18-
Version = "v2.4.0" // ${BUILD_VERSION:-`git describe --tags --dirty --always`}"
17+
// Version is updated by goreleaser
18+
Version = "v2-dev" // ${BUILD_VERSION:-`git describe --tags --dirty --always`}"
1919

2020
// These are initialized by the build script
2121

scripts/release.sh

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

scripts/release/package.json

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

0 commit comments

Comments
 (0)