diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml index 92095ae..d107923 100644 --- a/.forgejo/workflows/release.yaml +++ b/.forgejo/workflows/release.yaml @@ -5,10 +5,28 @@ on: tags: - "*" +env: + REGISTRY: git.froth.zone + IMAGE_NAME: ${{ github.repository }} + jobs: release: runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest 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: @@ -28,7 +46,7 @@ jobs: with: distribution: goreleaser version: latest - args: release --clean + args: release --clean --skip snapcraft env: GORELEASER_FORCE_TOKEN: gitea GITEA_TOKEN: ${{ secrets.PUBLISH_TOKEN }} diff --git a/.github/workflows/ghrelease.yaml b/.github/workflows/ghrelease.yaml index 537ec05..697244c 100644 --- a/.github/workflows/ghrelease.yaml +++ b/.github/workflows/ghrelease.yaml @@ -4,21 +4,44 @@ on: push: tags: - "*" +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: release: runs-on: ubuntu-latest + env: + SNAPCRAFT_STORE_CREDENTIALS : ${{ secrets.SNAPCRAFT_TOKEN }} + permissions: + contents: read + packages: write 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 @@ -28,6 +51,6 @@ jobs: 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 }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c85de73..557e5c0 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -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 @@ -183,18 +116,104 @@ 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 + 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 + directory: 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: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..75479d7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM scratch +ENTRYPOINT ["/awl"] +COPY awl / diff --git a/go.mod b/go.mod index 21b7796..2cd63b9 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 9ff2cbb..ec2979c 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml deleted file mode 100644 index 1d5d281..0000000 --- a/snap/snapcraft.yaml +++ /dev/null @@ -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