chore: Add Snap and Docker with Goreleaser
Forgejo Release / release (push) Failing after 1m6s Details
Mirror Push / mirror (push) Successful in 6s Details
Test / test (oldstable) (push) Successful in 45s Details
Test / test (stable) (push) Successful in 38s Details

Why not though snap sucks and docker seems kind of pointless since this is just a static file

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2024-04-17 18:20:06 +02:00
parent 7631dd7a7b
commit 40278ed22f
Signed by: sam
GPG Key ID: 4D8B07C18F31ACBD
7 changed files with 135 additions and 132 deletions

View File

@ -28,7 +28,7 @@ jobs:
with:
distribution: goreleaser
version: latest
args: release --clean
args: release --clean --skip docker,snapcraft
env:
GORELEASER_FORCE_TOKEN: gitea
GITEA_TOKEN: ${{ secrets.PUBLISH_TOKEN }}

View File

@ -4,30 +4,53 @@ on:
push:
tags:
- "*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release:
runs-on: ubuntu-latest
env:
SNAPCRAFT_STORE_CREDENTIALS : ${{ secrets.SNAPCRAFT_TOKEN }}
steps:
# Workaround a dumb docker problem where everything has to be lowercase
- id: lowercase
run: |
echo IMAGE_NAME=$(echo $IMAGE_NAME | tr '[:upper:]' '[:lower:]') >> "${GITHUB_ENV}"
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install Snapcraft
uses: samuelmeuli/action-snapcraft@v2
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.20.1'
go-version: stable
- name: Install scdoc
run: sudo apt-get install -y scdoc
- name: Workaround a dumb Snap bug
run: mkdir -p $HOME/.cache/snapcraft/download && mkdir -p $HOME/.cache/snapcraft/stage-packages
- name: Release with GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --skip=homebrew,nix,scoop
args: release --clean --skip=aur,homebrew,nix,scoop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -17,6 +17,9 @@ builds:
- plan9_amd64
- freebsd_amd64
universal_binaries:
- replace: true
archives:
- files:
- LICENSE
@ -42,75 +45,6 @@ archives:
meta: true
wrap_in_directory: "{{ .ProjectName }}"
universal_binaries:
- replace: true
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
groups:
- title: "Dependency Updates"
regexp: "^.*fix\\(deps\\)*:+.*$"
order: 2
- title: "Features"
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: "Other"
order: 999
filters:
exclude:
- "^test:"
- "^docs?:"
- "typo"
- "^ci:"
brews:
- repository:
owner: packaging
name: homebrew
homepage: https://dns.froth.zone/awl
description: A DNS query tool
license: BSD-3-Clause
# custom_block: |
# head "https://git.froth.zone/sam/awl.git"
install: |-
bin.install "awl"
bash_completion.install "completions/bash.bash" => "awl"
zsh_completion.install "completions/zsh.zsh" => "_awl"
fish_completion.install "completions/fish.fish" => "awl.fish"
man1.install "docs/awl.1.gz"
scoops:
- repository:
owner: packaging
name: scoop
folder: bucket
homepage: https://dns.froth.zone/awl
description: A DNS query client
license: BSD-3-Clause
nix:
-
repository:
owner: packaging
name: nur
homepage: https://dns.froth.zone/awl
description: A DNS query client
license: bsd3
extra_install: |-
installManPage ./docs/awl.1.gz
installShellCompletion ./completions/*
nfpms:
- id: packages
package_name: awl-dns
@ -170,7 +104,6 @@ nfpms:
{{- else if eq .Arch "arm" }}armhfp
{{- else if eq .Arch "arm64" }}aarch64
{{- else }}{{ .Arch }}{{ end -}}
- id: termux
package_name: awl-dns
vendor: Sam Therapy <sam@samtherapy.net>
@ -183,18 +116,105 @@ nfpms:
section: utils
formats:
- termux.deb
file_name_template: >-
{{- .PackageName }}_
{{- .Version }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i686
{{- else if eq .Arch "arm" }}arm
{{- else if eq .Arch "arm64" }}aarch64
{{- else }}{{ .Arch }}{{ end -}}
file_name_template: >-
{{- .PackageName }}_
{{- .Version }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i686
{{- else if eq .Arch "arm" }}arm
{{- else if eq .Arch "arm64" }}aarch64
{{- else }}{{ .Arch }}{{ end -}}
snapcrafts:
-
name: awl-dns
grade: stable
publish: true
summary: A command-line DNS query tool
description: |-
Awl is a command-line DNS query tool.
Awl supports DNS-over-[UDP,TCP,HTTPS,QUIC] and DNSCrypt.
confinement: strict
license: BSD-3-Clause
base: bare
apps:
awl-dns:
command: awl
plugs:
- network
completer: completions/bash.bash
dockers:
-
image_templates:
- "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:latest"
- "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:{{ .Tag }}"
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
brews:
- repository:
owner: packaging
name: homebrew
homepage: https://dns.froth.zone/awl
description: A DNS query tool
license: BSD-3-Clause
# custom_block: |
# head "https://git.froth.zone/sam/awl.git"
install: |-
bin.install "awl"
bash_completion.install "completions/bash.bash" => "awl"
zsh_completion.install "completions/zsh.zsh" => "_awl"
fish_completion.install "completions/fish.fish" => "awl.fish"
man1.install "docs/awl.1.gz"
nix:
- repository:
owner: packaging
name: nur
homepage: https://dns.froth.zone/awl
description: A DNS query client
license: bsd3
extra_install: |-
installManPage ./docs/awl.1.gz
installShellCompletion ./completions/*
scoops:
- repository:
owner: packaging
name: scoop
folder: bucket
homepage: https://dns.froth.zone/awl
description: A DNS query client
license: BSD-3-Clause
changelog:
sort: asc
groups:
- title: "Dependency Updates"
regexp: "^.*fix\\(deps\\)*:+.*$"
order: 2
- title: "Features"
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: "Bug fixes"
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: "Other"
order: 999
filters:
exclude:
- "^test:"
- "^docs?:"
- "typo"
- "^ci:"
uploads:
-
name: packages
- name: packages
method: PUT
mode: archive
exts:

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM scratch
ENTRYPOINT ["/awl"]
COPY awl /

6
go.mod
View File

@ -1,9 +1,11 @@
module dns.froth.zone/awl
go 1.22.2
go 1.21.9
toolchain go1.22.2
require (
dns.froth.zone/dnscrypt v0.0.1
dns.froth.zone/dnscrypt v0.0.2
github.com/dchest/uniuri v1.2.0
github.com/miekg/dns v1.1.58
github.com/quic-go/quic-go v0.42.0

4
go.sum
View File

@ -1,5 +1,5 @@
dns.froth.zone/dnscrypt v0.0.1 h1:plShBpr4lwQC9LNy6aUtKj4cyB1XSCrjutrUHdGIxtA=
dns.froth.zone/dnscrypt v0.0.1/go.mod h1:QZ0HAm7mWe8wz1dTqbKmTZhlr06x5qpe6ZCTPJ7uY30=
dns.froth.zone/dnscrypt v0.0.2 h1:ytqjic/Qway4OuLw8ee0ubxdNzy+F3igUGDrEVwyLls=
dns.froth.zone/dnscrypt v0.0.2/go.mod h1:QZ0HAm7mWe8wz1dTqbKmTZhlr06x5qpe6ZCTPJ7uY30=
github.com/AdguardTeam/golibs v0.20.3 h1:5RiDypxBebd4Y2eftwm6JJla18oBqRHwanR7q0rnrxw=
github.com/AdguardTeam/golibs v0.20.3/go.mod h1:/votX6WK1PdcZ3T2kBOPjPCGmfhlKixhI6ljYrFRPvI=
github.com/ameshkov/dnsstamps v1.0.3 h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=

View File

@ -1,45 +0,0 @@
# You may ask yourself, why make a snap?
# why not?
name: awl
base: bare
adopt-info: awl
license: BSD-3-Clause
summary: A command-line DNS query tool.
description: |
awl is a command line DNS tool, much like dig and drill.
icon: docs/img/awl.svg
issues:
- https://git.froth.zone/sam/awl/issues
- ~sammefishe/awl-devel@lists.sr.ht
grade: devel
confinement: strict
architectures:
- build-on: amd64
- build-on: arm64
- build-on: s390x
- build-on: ppc64el
- build-on: armhf
parts:
awl:
build-packages:
- scdoc
plugin: go
source-type: git
source: https://git.froth.zone/sam/awl
override-pull: |
snapcraftctl pull
snapcraftctl set-version "$(git describe --always | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || echo 'UNKNOWN')"
override-build: |
HASH=$(git describe --always | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || echo 'UNKNOWN')+snap make
PREFIX=$SNAPCRAFT_PART_INSTALL make install
apps:
awl:
command: bin/awl
completer: share/bash-completion/completions/awl
plugs:
- network