build: Add building
Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
parent
a0ff16465d
commit
6b22e870a1
2 changed files with 52 additions and 3 deletions
29
.build.yml
Normal file
29
.build.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
image: alpine/edge
|
||||||
|
packages:
|
||||||
|
- go
|
||||||
|
- just
|
||||||
|
- hut
|
||||||
|
sources:
|
||||||
|
- git@git.sr.ht:~timharek/yr
|
||||||
|
triggers:
|
||||||
|
- action: email
|
||||||
|
condition: failure
|
||||||
|
to: Tim Hårek Andreassen <tim@harek.no>
|
||||||
|
tasks:
|
||||||
|
- setup: |
|
||||||
|
echo 'cd yr' >> ~/.buildenv
|
||||||
|
- test: |
|
||||||
|
just test
|
||||||
|
- build: |
|
||||||
|
tag=$(git describe --exact-match 2>/dev/null || true)
|
||||||
|
if [ -z "$tag" ]; then
|
||||||
|
echo "Current commit is not a tag; not building anything"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
version=$(echo "$tag" | tr -d 'v')
|
||||||
|
|
||||||
|
just build-release $tag $version darwin amd64
|
||||||
|
just build-release $tag $version darwin arm64
|
||||||
|
just build-release $tag $version linux amd64
|
||||||
|
just build-release $tag $version windows amd64
|
26
justfile
26
justfile
|
@ -1,9 +1,8 @@
|
||||||
|
builddir := "./build"
|
||||||
|
|
||||||
default:
|
default:
|
||||||
just --list
|
just --list
|
||||||
|
|
||||||
build:
|
|
||||||
echo "not implemented yet"
|
|
||||||
|
|
||||||
dev +args='--help':
|
dev +args='--help':
|
||||||
go run main.go {{args}}
|
go run main.go {{args}}
|
||||||
|
|
||||||
|
@ -15,3 +14,24 @@ tidy:
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
go vet ./...
|
go vet ./...
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f build/*
|
||||||
|
rm -rf yr-*
|
||||||
|
rm -f yr-*.tar.gz
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build -o {{builddir}}/
|
||||||
|
|
||||||
|
build-release tag version os arch:
|
||||||
|
GOOS="{{os}}" GOARCH="{{arch}}" just build
|
||||||
|
|
||||||
|
mkdir -p yr-{{version}}
|
||||||
|
cp {{builddir}}/yr yr-{{version}}/
|
||||||
|
|
||||||
|
if [ {{os}} = windows ]; then \
|
||||||
|
mv yr-{{version}}/yr{,.exe}; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
tar czf yr-{{version}}-{{os}}-{{arch}}.tar.gz yr-{{version}}
|
||||||
|
hut git artifact upload --rev {{tag}} yr-{{version}}-{{os}}-{{arch}}.tar.gz
|
||||||
|
|
Loading…
Reference in a new issue