Skip to content

Commit

Permalink
justfile: replace makefile
Browse files Browse the repository at this point in the history
The project intentionally no longer ships packaging instructions.

I don't follow the best guidelines (e.g. go flags), and I don't want to highlight make over any other build system.

As a packager you do not need to pass -ldflags "-X main.version=xxx" if you are using git-archive source tarballs,
where the version is already hardcoded.
  • Loading branch information
maximbaz committed Jan 9, 2025
1 parent 0b7e9e4 commit 11f8c35
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 58 deletions.
58 changes: 0 additions & 58 deletions Makefile

This file was deleted.

33 changes: 33 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
default: release

app := "yubikey-touch-detector"
version := `git describe --tags`

release: clean vendor
mkdir -p dist
git archive -o "dist/{{app}}-{{version}}.tar.gz" --format tar.gz --prefix "{{app}}-{{version}}/" "{{version}}"
git archive -o "dist/{{app}}-{{version}}-src.tar.gz" --format tar.gz `find vendor -type f -printf '--prefix={{app}}-{{version}}/%h/ --add-file=%p '` --prefix "{{app}}-{{version}}/" "{{version}}"

for file in dist/*; do \
gpg --detach-sign --armor "$file"; \
done

rm -f "dist/{{app}}-{{version}}.tar.gz"

run *args:
go run main.go {{args}}

build:
# if you are building from git-archive tarballs, no need to pass -ldflags, the version is already hardcoded in main.go
go build -ldflags "-X main.version={{version}}" -o {{app}} main.go
scdoc < '{{app}}.1.scd' > '{{app}}.1'

vendor:
go mod tidy
go mod vendor

clean:
rm -f {{app}}
rm -f {{app}}.1
rm -rf dist
rm -rf vendor

0 comments on commit 11f8c35

Please sign in to comment.