Skip to content

Commit

Permalink
update goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbekhen committed Nov 30, 2023
1 parent 8fb1e4d commit 635dc20
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 84 deletions.
249 changes: 165 additions & 84 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,129 +1,210 @@
version: 1

project_name: nanoproxy

dist: dist

before:
hooks:
- go mod tidy

snapshot:
name_template: '{{ incpatch .Version }}-next'

metadata:
mod_timestamp: "{{ .CommitTimestamp }}"

builds:
- binary: nanoproxy
ldflags:
- -s -w -X github.com/ryanbekhen/nanoproxy.Version={{ .Version }}
- -s -w -X nanoproxy.version={{.Version}} -X nanoproxy.commit={{.Commit}} -X nanoproxy.date={{ .CommitDate }} -X nanoproxy.builtBy=goreleaser -X nanoproxy.treeState={{ .IsGitDirty }}
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- "386"
- amd64
- arm
- arm64
- ppc64
goarm:
- "7"
ignore:
- goos: windows
goarch: arm
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath

universal_binaries:
- replace: false

checksum:
name_template: "checksums.txt"

changelog:
use: github
sort: asc
groups:
- title: Dependency updates
regexp: '^.*?(feat|fix)\(deps\)!?:.+$'
order: 300
- title: "New Features"
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
order: 100
- title: "Security updates"
regexp: '^.*?sec(\([[:word:]]+\))??!?:.+$'
order: 150
- title: "Bug fixes"
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
order: 200
- title: "Documentation updates"
regexp: ^.*?doc(\([[:word:]]+\))??!?:.+$
order: 400
- title: "Build process updates"
regexp: ^.*?build(\([[:word:]]+\))??!?:.+$
order: 400
- title: Other work
order: 9999
filters:
exclude:
- "^test:"
- "^chore"
- "merge conflict"
- Merge pull request
- Merge remote-tracking branch
- Merge branch
- go mod tidy

dockers:
- image_templates:
- "ghcr.io/ryanbekhen/nanoproxy:{{ .Version }}"
- "ghcr.io/ryanbekhen/nanoproxy:latest"
- "ghcr.io/ryanbekhen/nanoproxy:{{ .Version }}-amd64"
dockerfile: Dockerfile
build_flag_templates:
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/ryanbekhen/nanoproxy
- --label=org.opencontainers.image.source=https://github.com/ryanbekhen/nanoproxy
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
- "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ryanbekhen/nanoproxy/main/README.md"
- '--label=io.artifacthub.package.maintainers=[{"name":"Achmad Irianto Eka Putra","email":"[email protected]"}]'
- "--label=io.artifacthub.package.license=MIT"
- "--label=org.opencontainers.image.description=Nanoproxy is a simple proxy written in Go."
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/amd64"
- image_templates:
- "ghcr.io/ryanbekhen/nanoproxy:{{ .Version }}-arm64"
dockerfile: Dockerfile
build_flag_templates:
- "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ryanbekhen/nanoproxy/main/README.md"
- '--label=io.artifacthub.package.maintainers=[{"name":"Achmad Irianto Eka Putra","email":"[email protected]"}]'
- "--label=io.artifacthub.package.license=MIT"
- "--label=org.opencontainers.image.description=Nanoproxy is a simple proxy written in Go."
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--platform=linux/arm64"
goarch: arm64

nfpms:
- file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
homepage: https://github.com/ryanbekhen/nanoproxy
description: "nanoproxy is a simple reverse proxy written in Go."
maintainer: "Achmad Irianto Eka Putra <[email protected]>"
license: "MIT"
vendor: ryanbekhen
contents:
- src: systemd/nanoproxy.service
dst: /etc/systemd/system/nanoproxy.service
type: "config|noreplace"
- src: config/nanoproxy
dst: /etc/nanoproxy/nanoproxy
type: "config|noreplace"
formats:
- apk
- deb
- rpm
docker_manifests:
- name_template: "ghcr.io/ryanbekhen/nanoproxy:{{ .Version }}"
image_templates:
- "ghcr.io/ryanbekhen/nanoproxy:{{ .Version }}-amd64"
- "ghcr.io/ryanbekhen/nanoproxy:{{ .Version }}-arm64"
- name_template: "ghcr.io/ryanbekhen/nanoproxy:latest{{ end }}"
image_templates:
- "ghcr.io/ryanbekhen/nanoproxy:v{{ .Version }}-amd64"
- "ghcr.io/ryanbekhen/nanoproxy:v{{ .Version }}-arm64"

archives:
- name_template: >-
{{- .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end -}}
format_overrides:
- goos: windows
format: zip
builds_info:
group: root
owner: root
files:
- README.md
- LICENSE
brews:
- name: nanoproxy
repository:
owner: ryanbekhen
name: nanoproxy-homebrew-tap
folder: Formula
goarm: 7
homepage: https://github.com/ryanbekhen/nanoproxy
description: "nanoproxy is a simple reverse proxy written in Go."
license: "MIT"
folder: Formula
install: |
bin.install "nanoproxy"
repository:
owner: ryanbekhen
name: nanoproxy
branch: master
winget:
- name: nanoproxy
package_identifier: ryanbekhen.nanoproxy
publisher: ryanbekhen
description: "nanoproxy is a simple reverse proxy written in Go."
short_description: "nanoproxy is a simple reverse proxy written in Go."
publisher_url: https://ryanbekhen.dev
publisher_support_url: https://ryanbekhen.dev
license: MIT
license_url: https://github.com/ryanbekhen/nanoproxy/blob/master/LICENSE
homepage: https://github.com/ryanbekhen/nanoproxy
author: ryanbekhen
release_notes: "{{.Changelog}}"
copyright: ryanbekhen
copyright_url: https://github.com/ryanbekhen/nanoproxy/blob/master/LICENSE
short_description: "nanoproxy is a simple reverse proxy written in Go."
tags:
- Proxy
- Socks5
repository:
owner: ryanbekhen
name: nanoproxy
branch: master
name: nanoproxy-winget-pkgs
branch: "nanoproxy-{{ .Version }}"
pull_request:
enabled: true
draft: true
base:
owner: microsoft
name: winget-pkgs
branch: master

release:
draft: false
nfpms:
- id: packages
file_name_template: "{{ .ConventionalFileName }}"
homepage: https://github.com/ryanbekhen/nanoproxy
description: "nanoproxy is a simple reverse proxy written in Go."
maintainer: "Achmad Irianto Eka Putra <[email protected]>"
license: "MIT"
vendor: ryanbekhen
bindir: /usr/bin
section: utils
contents:
- src: systemd/nanoproxy.service
dst: /etc/systemd/system/nanoproxy.service
type: "config|noreplace"
- src: config/nanoproxy
dst: /etc/nanoproxy/nanoproxy
type: "config|noreplace"
formats:
- apk
- deb
- rpm
deb:
lintian_overrides:
- statically-linked-binary
- changelog-file-missing-in-native-package

publishers:
- name: fury.io
dir: "{{ dir .ArtifactPath }}"
cmd: curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/ryanbekhen/

archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
wrap_in_directory: true
format_overrides:
- goos: windows
format: zip

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: '{{ incpatch .Version }}-next'
ids:
- packages
env:
- "FURY_TOKEN={{ .Env.FURY_TOKEN }}"
cmd: ./scripts/fury-upload.sh {{ .ArtifactName }}

changelog:
use: git
sort: asc
groups:
- title: ':rocket: Features'
regexp: "^.*feat[(\\w)]*:+.*$"
order: 0
- title: ':bug: Fixes'
regexp: "^.*fix[(\\w)]*:+.*$"
order: 1
- title: ':hammer_and_wrench: Enhancements'
regexp: "^.*chore[(\\w)]*:+.*$"
order: 2
- title: ':gear: Others'
order: 999
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch
release:
name_template: "{{ .Version }}"
12 changes: 12 additions & 0 deletions scripts/fury-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -e
if [ "${1: -4}" == ".deb" ] || [ "${1: -4}" == ".rpm" ]; then
cd dist
echo "uploading $1"
status="$(curl -s -q -o /dev/null -w "%{http_code}" -F package="@$1" "https://$FURY_TOKEN@push.fury.io/ryanbekhen/")"
echo "got: $status"
if [ "$status" == "200" ] || [ "$status" == "409" ]; then
exit 0
fi
exit 1
fi

0 comments on commit 635dc20

Please sign in to comment.