-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch release to goreleaser, add deb and rpm #2
- Loading branch information
Showing
10 changed files
with
85 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin/ | ||
dist/ |
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 |
---|---|---|
|
@@ -13,4 +13,5 @@ | |
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
bin/ | ||
bin/ | ||
dist/ |
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,54 @@ | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
- freebsd | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
ignore: | ||
- goos: freebsd | ||
goarch: arm | ||
- goos: freebsd | ||
goarch: arm64 | ||
dir: app | ||
ldflags: "-s -w -X main.revision={{.Version}}-{{.CommitDate}}" | ||
|
||
archives: | ||
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
replacements: | ||
386: i386 | ||
amd64: x86_64 | ||
darwin: macos | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
files: | ||
- LICENSE | ||
- README.md | ||
|
||
nfpms: | ||
- | ||
package_name: cronn | ||
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
vendor: Umputun | ||
homepage: https://github.com/umputun/cronn | ||
maintainer: Umputun <umputun@gmail.com> | ||
description: cron replacement with extras | ||
license: MIT | ||
formats: | ||
- deb | ||
- rpm | ||
bindir: /usr/bin | ||
epoch: 1 | ||
release: 1 | ||
files: | ||
"cronn.service": "/etc/systemd/system/cronn.service" | ||
"crontab.example": "/etc/cronntab" | ||
scripts: | ||
postinstall: "scripts/postinstall.sh" | ||
preremove: "scripts/preremove.sh" |
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 |
---|---|---|
@@ -1,31 +1,17 @@ | ||
FROM umputun/baseimage:buildgo-latest as build | ||
FROM goreleaser/goreleaser as build | ||
|
||
WORKDIR /build | ||
ADD . /build | ||
|
||
RUN \ | ||
version=$(/script/git-rev.sh); \ | ||
echo "version=$version" && \ | ||
export GOFLAGS="-mod=vendor" && \ | ||
echo "linux-amd64" && GOOS=linux GOARCH=amd64 go build -o cronn.linux-amd64 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "linux-386" && GOOS=linux GOARCH=386 go build -o cronn.linux-386 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "linux-arm" && GOOS=linux GOARCH=arm go build -o cronn.linux-arm -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "linux-arm64" && GOOS=linux GOARCH=arm64 go build -o cronn.linux-arm64 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "windows-amd64" && GOOS=windows GOARCH=amd64 go build -o cronn.windows-amd64.exe -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "darwin-amd64" && GOOS=darwin GOARCH=amd64 go build -o cronn.darwin-amd64 -ldflags "-X main.revision=${version} -s -w" ./app && \ | ||
echo "freebsd-amd64" && GOOS=freebsd GOARCH=amd64 go build -o cronn.freebsd-amd64 -ldflags "-X main.revision=${version} -s -w" ./app | ||
RUN goreleaser --snapshot --skip-publish --rm-dist | ||
|
||
FROM alpine | ||
COPY --from=build /build/dist/ /dist/ | ||
RUN \ | ||
apk add --no-cache --update zip && \ | ||
tar cvzf cronn.linux-amd64.tar.gz cronn.linux-amd64 LICENSE README.md && \ | ||
tar cvzf cronn.linux-386.tar.gz cronn.linux-386 LICENSE README.md && \ | ||
tar cvzf cronn.linux-arm.tar.gz cronn.linux-arm LICENSE README.md && \ | ||
tar cvzf cronn.linux-arm64.tar.gz cronn.linux-arm64 LICENSE README.md && \ | ||
tar cvzf cronn.darwin-amd64.tar.gz cronn.darwin-amd64 LICENSE README.md && \ | ||
tar cvzf cronn.freebsd-amd64.tar.gz cronn.freebsd-amd64 LICENSE README.md && \ | ||
zip cronn.windows-amd64.zip cronn.windows-amd64.exe LICENSE README.md | ||
mkdir -p /artifacts && \ | ||
cp /dist/*.gz /artifacts/ && \ | ||
cp /dist/*.zip /artifacts/ && \ | ||
cp /dist/*.txt /artifacts/ && \ | ||
ls -la /artifacts/* | ||
|
||
FROM alpine | ||
COPY --from=build /build/cronn.* /artifacts/ | ||
RUN ls -la /artifacts/* | ||
CMD ["sleep", "100"] |
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 |
---|---|---|
@@ -1,20 +1,15 @@ | ||
docker: | ||
docker build -t umputun/cronn . | ||
|
||
bin: | ||
dist: | ||
- @mkdir -p dist | ||
docker build -f Dockerfile.artifacts -t cronn.bin . | ||
- @docker rm -f cronn.bin 2>/dev/null || exit 0 | ||
- @mkdir -p bin | ||
docker run -d --name=cronn.bin cronn.bin | ||
docker cp cronn.bin:/artifacts/cronn.linux-amd64.tar.gz bin/cronn.linux-amd64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.linux-386.tar.gz bin/cronn.linux-386.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.linux-arm64.tar.gz bin/cronn.linux-arm64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.darwin-amd64.tar.gz bin/cronn.darwin-amd64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.freebsd-amd64.tar.gz bin/cronn.freebsd-amd64.tar.gz | ||
docker cp cronn.bin:/artifacts/cronn.windows-amd64.zip bin/cronn.windows-amd64.zip | ||
docker cp cronn.bin:/artifacts dist/ | ||
docker rm -f cronn.bin | ||
|
||
race_test: | ||
cd app && go test -race -mod=vendor -timeout=60s -count 1 ./... | ||
|
||
.PHONY: bin docker | ||
.PHONY: dist docker race_test |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
*/5 * * * * ls -la . | ||
*/2 1-18 * * * export | ||
*/1 * * * * echo {{.YYYYMMDD}} | ||
*/1 * * * * something blah bad | ||
# */5 * * * * ls -la . | ||
# */2 1-18 * * * export | ||
# */1 * * * * echo {{.YYYYMMDD}} | ||
# @every 1h15m something blah bad |
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,3 @@ | ||
#!/bin/sh | ||
systemctl start cronn | ||
systemctl enable cronn |
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,3 @@ | ||
#!/bin/sh | ||
systemctl stop cronn | ||
systemctl disable cronn |