Skip to content

Commit f7235db

Browse files
author
Julien Castets
committed
Split make prepare-release
The Makefile rule `make prepare-release` was used to build: * scaleway-cli dist files for several architectures * scaleway-cli debian packages * scaleway-cli Docker image By splitting the Makefile rule into the three rules, it is possible to call make prepare-release-dist from a container (so no need to have go installed on the host) and the two other rules, prepare-release-debian-packages and prepare-release-docker-image, from a Docker host (since they spawn a Docker container).
1 parent f4a8743 commit f7235db

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

MAINTAINERS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ For the sake of the example, we assume you want to release the version `42.8`.
2424

2525
* [Draft a new release](https://github.com/scaleway/scaleway-cli/releases) on
2626
Github.
27-
* Build release files: `make prepare-release`.
28-
* Upload the generated files in *dist/42.8/* to github.
29-
* Publish the release.
27+
* Build cross-compiled files: `make prepare-release-dist`.
28+
* Build debian packages: `make prepare-release-debian-packages VERSION=42.8`.
29+
**The VERSION should not include the leading "v"**.
30+
* Upload the generated files in `dist/latest` and publish the release.
3031

3132
### Docker image
3233

33-
The image *scaleway/cli* has been created by `make prepare-release` called
34-
during the previous step.
35-
34+
* Call `make prepare-release-docker-image VERSION=42.8`. **The VERSION should
35+
not include the leading "v"**.
3636
* Push the local Docker image to the Docker hub: `docker push scaleway/cli`.
3737

3838
### Homebrew (OSX) package

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fmt: $(FMT_LIST)
7070

7171
$(BUILD_LIST): %_build: %_fmt
7272
@go tool vet --all=true $(shell echo $(SOURCES) | tr " " "\n" | grep -v test.go)
73-
$(GOBUILD) -i -ldflags $(LDFLAGS) -o $(NAME) ./cmd/$(NAME)
73+
$(GOBUILD) -ldflags $(LDFLAGS) -o $(NAME) ./cmd/$(NAME)
7474

7575
$(CLEAN_LIST): %_clean:
7676
$(GOCLEAN) $(subst $(GODIR),./,$*)
@@ -84,7 +84,7 @@ $(TEST_LIST): %_test:
8484
$(FMT_LIST): %_fmt:
8585
@$(GOFMT) $(SOURCES)
8686

87-
prepare-release: build
87+
prepare-release-dist: build
8888
### Prepare dist/ directory ###
8989
$(eval VERSION := $(shell ./scw version | sed -n 's/Client version: v\(.*\)/\1/p'))
9090
rm -rf dist/$(VERSION)
@@ -111,21 +111,21 @@ prepare-release: build
111111
GOOS=windows GOARCH=386 go build -o dist/latest/scw-windows-i386.exe github.com/scaleway/scaleway-cli/cmd/scw
112112
GOOS=windows GOARCH=amd64 go build -o dist/latest/scw-windows-amd64.exe github.com/scaleway/scaleway-cli/cmd/scw
113113

114+
prepare-release-docker-image: dist/latest/scw-linux-i386
115+
@echo ${VERSION} | grep -qv 'v' || ( echo "ERROR: VERSION not set or contains a leading 'v'" >&2 && exit 1 )
114116
### Prepare scaleway-cli Docker image ###
115117
docker run --rm golang tar -cf - /etc/ssl > dist/ssl.tar
116118
docker build -t scaleway/cli dist
117119
docker run scaleway/cli version
118-
docker tag scaleway/cli:latest scaleway/cli:$(TAG)
120+
docker tag scaleway/cli:latest scaleway/cli:v$(VERSION)
119121

122+
prepare-release-debian-packages: dist/latest/scw-linux-amd64 dist/latest/scw-linux-i386 dist/latest/scw-linux-arm
123+
@echo ${VERSION} | grep -qv 'v' || ( echo "ERROR: VERSION not set or contains a leading 'v'" >&2 && exit 1 )
120124
### Build debian packages ###
121125
docker run -v $(PWD)/dist/latest/scw-linux-amd64:/input/usr/bin/scw $(FPM_DOCKER) $(FPM_ARGS) --version $(VERSION) -t deb -a x86_64 ./
122126
docker run -v $(PWD)/dist/latest/scw-linux-i386:/input/usr/bin/scw $(FPM_DOCKER) $(FPM_ARGS) --version $(VERSION) -t deb -a i386 ./
123127
docker run -v $(PWD)/dist/latest/scw-linux-arm:/input/usr/bin/scw $(FPM_DOCKER) $(FPM_ARGS) --version $(VERSION) -t deb -a arm ./
124128

125-
### DONE ###
126-
@echo "Release files have been created into dist/latest. See MAINTAINERS.md."
127-
@echo "The scaleway-cli Docker image has been created. See MAINTAINERS.md."
128-
129129

130130
.PHONY: golint
131131
golint:

0 commit comments

Comments
 (0)