feat(packaging): Prepare for apt packaging (#139)
All checks were successful
continuous-integration/drone/push Build is passing

This needs to be tested (preferably extensively), which I will do now

Reviewed-on: #139
Reviewed-by: grumbulon <grumbulon@grumbulon.xyz>
This commit is contained in:
Sam Therapy 2022-10-14 14:11:01 +00:00
parent 2d94ea6838
commit add1ef61a2
Signed by: Froth Git
GPG key ID: 5D8CD75CC6B79913
9 changed files with 96 additions and 39 deletions

View file

@ -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: {},

1
.gitignore vendored
View file

@ -24,5 +24,6 @@ coverage/*
awl
doc/awl.1
doc/awl.1.gz
.dccache

View file

@ -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 <sam@samtherapy.net>
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/

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,3 @@
#!/usr/bin/env fish
# SPDX-License-Identifier: BSD-3-Clause
function __fish_complete_awl
set -l token (commandline -ct)

View file

@ -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

7
doc/makeman.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
set -e
rm -f doc/awl.1.gz
scdoc <doc/awl.1.scd >doc/awl.1
gzip -9 -n doc/awl.1