diff --git a/.drone.jsonnet b/.drone.jsonnet index e692f51..e4c86e4 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -10,13 +10,16 @@ local testing(version, arch) = { steps: [ { name: 'lint', - image: 'rancher/drone-golangci-lint:latest', + image: 'golangci/golangci-lint', + commands: [ + 'golangci-lint run ./...', + ], }, { name: 'cache', image: 'golang:' + version, commands: [ - 'go mod tidy' + 'go mod tidy', ], depends_on: [ 'lint', @@ -81,6 +84,9 @@ local release() = { kind: 'pipeline', type: 'docker', name: 'release', + clone: { + disable: true, + }, trigger: { event: [ 'tag', @@ -88,11 +94,11 @@ local release() = { }, steps: [ { - name: 'fetch', - image: 'alpine/git', - commands: [ - 'git fetch --tags', - ], + name: 'clone', + image: 'woodpeckerci/plugin-git', + settings: { + tags: true, + }, }, { name: 'test', @@ -116,6 +122,7 @@ local release() = { }, }, commands: [ + 'apk add --no-cache scdoc', 'goreleaser release', ], volumes: [ @@ -125,8 +132,27 @@ local release() = { }, ], }, + { + name: 'trigger', + image: 'plugins/downstream', + settings: { + server: 'ci.git.froth.zone', + token: { + DRONE_TOKEN: { + from_secret: 'DRONE_TOKEN', + }, + }, + fork: true, + repositories: [ + 'packages/awl', + ], + parameters: [ + 'TAG=${DRONE_TAG}', + ], + }, + }, ], - volumes: [ + volumes: [ { name: 'cache', temp: {}, diff --git a/.gitignore b/.gitignore index 301fd5b..fb7ea08 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,6 @@ coverage/* awl doc/awl.1 +doc/awl.1.gz .dccache \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml index da446bc..2c16859 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -2,47 +2,32 @@ # Make sure to check the documentation at https://goreleaser.com before: hooks: + - make clean # You may remove this if you don't use go modules. - go mod tidy # you may remove this if you don't need go generate # - go generate ./... + - doc/makeman.sh builds: - env: - CGO_ENABLED=0 - goos: - - linux - - windows - - darwin - - freebsd - goarch: - - amd64 - - arm - - arm64 - ignore: - # Windows on ARM, maybe someday - - goos: windows - goarch: arm64 - - goos: windows - goarch: arm - - - goos: darwin - goarch: arm - - goos: freebsd - goarch: arm + targets: + - go_first_class + - plan9_amd64 + - freebsd_amd64 universal_binaries: - replace: true archives: - - - files: + - files: - LICENCE - completions/** + - doc/awl.1.gz replacements: darwin: macOS linux: Linux windows: Windows - amd64: x86_64 format_overrides: - goos: windows format: zip @@ -57,16 +42,16 @@ changelog: sort: asc groups: - - title: 'Dependency Updates' + - title: "Dependency Updates" regexp: "^.*fix\\(deps\\)*:+.*$" order: 2 - - title: 'Features' + - title: "Features" regexp: "^.*feat[(\\w)]*:+.*$" order: 0 - - title: 'Bug fixes' + - title: "Bug fixes" regexp: "^.*fix[(\\w)]*:+.*$" order: 1 - - title: 'Other' + - title: "Other" order: 999 filters: @@ -77,5 +62,42 @@ changelog: - "typo" - "^ci:" +nfpms: + - id: packages + maintainer: Sam + homepage: https://dns.froth.zone/awl + description: |- + Command-line DNS query tool. + Awl supports DNS-over-[UDP,TCP,HTTPS,QUIC] and DNSCrypt. + license: BSD 3 Clause + bindir: /usr/bin + section: utils + formats: + - deb + # - rpm + # - apk + contents: + - src: completions/bash.bash + dst: /usr/share/bash-completion/completions/awl + - src: completions/zsh.zsh + dst: /usr/share/zsh/vendor-completions/_awl + packager: deb + - src: completions/zsh.zsh + dst: /usr/share/zsh/site-functions/_awl + packager: apk + - src: completions/zsh.zsh + dst: /usr/share/zsh/site-functions/_awl + packager: rpm + - src: completions/fish.fish + dst: /usr/share/fish/vendor_completions.d/awl.fish + - src: doc/awl.1.gz + dst: /usr/share/man/man1/awl.1.gz + - src: LICENCE + dst: /usr/share/doc/awl/copyright + deb: + lintian_overrides: + - statically-linked-binary + - changelog-file-missing-in-native-package + gitea_urls: api: https://git.froth.zone/api/v1/ diff --git a/GNUmakefile b/GNUmakefile index d653d9c..e9fbf99 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -18,6 +18,7 @@ else install: all install -Dm755 $(PROG) $(DESTDIR)$(PREFIX)/$(BIN)/$(PROG) install -Dm644 doc/$(PROG).1 $(DESTDIR)$(MAN)/man1/$(PROG).1 + gzip -9 $(DESTDIR)$(MAN)/man1/$(PROG).1 # completions need to go in one specific place :) install -Dm644 completions/bash.bash $(DESTDIR)$(PREFIX)/$(SHARE)/bash-completion/completions/$(PROG) install -Dm644 completions/fish.fish $(DESTDIR)$(PREFIX)/$(SHARE)/fish/vendor_completions.d/$(PROG).fish diff --git a/Makefile b/Makefile index 49cc06f..31c1c9e 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ EXE := $(PROG) install: all install -Dm755 $(PROG) $(DESTDIR)$(PREFIX)/$(BIN)/$(PROG) install -Dm644 doc/$(PROG).1 $(DESTDIR)$(MAN)/man1/$(PROG).1 + gzip -9 $(DESTDIR)$(MAN)/man1/$(PROG).1 # completions need to go in one specific place :) install -Dm644 completions/bash.bash $(DESTDIR)$(PREFIX)$(SHARE)/bash-completion/completions/$(PROG) install -Dm644 completions/fish.fish $(DESTDIR)$(PREFIX)$(SHARE)/fish/vendor_completions.d/$(PROG).fish diff --git a/completions/bash.bash b/completions/bash.bash index 570f8c3..8e5c287 100644 --- a/completions/bash.bash +++ b/completions/bash.bash @@ -1,6 +1,6 @@ -#!/usr/bin/env bash -# bash completion for awl -*- shell-script -*- # SPDX-License-Identifier: BSD-3-Clause +# bash completion for awl -*- shell-script -*- + # TODO: MAKE THIS A REAL THING complete -F _known_hosts awl diff --git a/completions/fish.fish b/completions/fish.fish index 69c343c..5d74c37 100644 --- a/completions/fish.fish +++ b/completions/fish.fish @@ -1,4 +1,3 @@ -#!/usr/bin/env fish # SPDX-License-Identifier: BSD-3-Clause function __fish_complete_awl set -l token (commandline -ct) diff --git a/completions/zsh.zsh b/completions/zsh.zsh index 64afd0c..346cbf9 100644 --- a/completions/zsh.zsh +++ b/completions/zsh.zsh @@ -96,7 +96,7 @@ _arguments -s -C $args \ '*--tls-host+[set TLS lookup hostname]:host:_hosts' \ '*-'{s,-short}'+[print terse output]' \ '*-'{j,-json}'+[present the results as JSON]' \ - '*-'{x,-xml}'+[present the results as XML]' \ + '*-'{X,-xml}'+[present the results as XML]' \ '*-'{y,-yaml}'+[present the results as YAML]' \ '*: :->args' && ret=0 diff --git a/doc/makeman.sh b/doc/makeman.sh new file mode 100755 index 0000000..fbaa55e --- /dev/null +++ b/doc/makeman.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +rm -f doc/awl.1.gz +scdoc doc/awl.1 +gzip -9 -n doc/awl.1