Skip to content

Commit

Permalink
feat(goreleaser): Vastly simplify upload process (#229)
Browse files Browse the repository at this point in the history
Make the upload process to Gitea packages much less of a clusterbomb

Reviewed-on: https://git.froth.zone/sam/awl/pulls/229
  • Loading branch information
SamTherapy committed Nov 8, 2023
1 parent 2565d34 commit 26ef04b
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitea/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ jobs:
args: release --rm-dist
env:
GITEA_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
UPLOAD_PACKAGES_USERNAME: sam
UPLOAD_PACKAGES_SECRET: ${{ secrets.PUBLISH_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ghrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
with:
distribution: goreleaser
version: latest
args: release --rm-dist
args: release --rm-dist --skip=homebrew,nix,scoop,upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104 changes: 91 additions & 13 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ archives:
{{- if eq .Os "darwin" }}MacOS_
{{- else if eq .Os "freebsd" }}FreeBSD_
{{- else }}{{- title .Os }}_{{ end }}
{{- .Arch }}
{{- if eq .Arch "386" }}i386
{{- else if eq .Arch "mips64" }}mips64_hardfloat
{{- else if eq .Arch "mips64le" }}mips64le_hardfloat
{{- else }}{{ .Arch }}{{ end -}}
format_overrides:
- goos: windows
format: zip
Expand Down Expand Up @@ -73,7 +76,7 @@ changelog:

brews:
- repository:
owner: sam
owner: packaging
name: homebrew
homepage: https://dns.froth.zone/awl
description: A DNS query tool
Expand All @@ -89,50 +92,125 @@ brews:
scoops:
- repository:
owner: sam
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: BSD-3-Clause
extra_install:
installManPage ./doc/awl.1.gz
post_install: |
installShellCompletion ./completions/*
nfpms:
- id: packages
maintainer: Sam <sam@samtherapy.net>
homepage: https://dns.froth.zone/awl
package_name: awl-dns
vendor: Sam Therapy <sam@samtherapy.net>
maintainer: Sam Therapy <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
section: utils
bindir: /usr/bin
formats:
- apk
- archlinux
- deb
- rpm
- apk
- termux.deb
contents:
- src: completions/bash.bash
dst: /usr/share/bash-completion/completions/awl
- src: doc/awl.1.gz
dst: /usr/share/man/man1/awl.1.gz
- src: LICENCE
dst: /usr/share/doc/awl/copyright
- src: completions/fish.fish
dst: /usr/share/fish/vendor_completions.d/awl.fish
# DEB only
- src: completions/zsh.zsh
dst: /usr/share/zsh/vendor-completions/_awl
packager: deb
# Alpine .apk only
- src: completions/zsh.zsh
dst: /usr/share/zsh/site-functions/_awl
packager: apk
# RPM only
- 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
overrides:
deb:
file_name_template: >-
{{- .PackageName }}_
{{- .Version }}_
{{- if eq .Arch "386" }}i386
{{- else if eq .Arch "arm" }}armel
{{- else }}{{ .Arch }}{{ end -}}
rpm:
file_name_template: >-
{{- .PackageName }}-
{{- .Version }}-
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i686
{{- 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>
maintainer: Sam Therapy <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
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 -}}
uploads:
-
name: packages
method: PUT
mode: archive
exts:
- deb
- rpm
- apk
- termux.deb
username: sam
target: >-
https://git.froth.zone/api/packages/sam/
{{- if eq .ArtifactExt "deb" }}debian/pool/sid/main/upload
{{- else if eq .ArtifactExt "termux.deb" }}debian/pool/termux/main/upload
{{- else if eq .ArtifactExt "rpm" }}rpm/upload
{{- else if eq .ArtifactExt "apk" }}alpine/edge/main{{ end -}}
custom_artifact_name: true # Truncate the artifact name from the upload URL

gitea_urls:
api: https://git.froth.zone/api/v1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Grab a prebuilt binary from the
- Scoop:

```pwsh
scoop bucket add froth https://git.froth.zone/sam/scoop.git
scoop bucket add froth https://git.froth.zone/packages/scoop.git
scoop install awl
```

Expand Down
1 change: 1 addition & 0 deletions template.mk
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ clean:
# Ignore errors if you remove something that doesn't exist
rm -f doc/$(PROG).1
rm -f coverage/cover*
rm -rf vendor

## help: Prints this help message
.PHONY: help
Expand Down

0 comments on commit 26ef04b

Please sign in to comment.