goreleaser / nfpm

nFPM is Not FPM - a simple deb, rpm, apk, ipk, and arch linux packager written in Go
https://nfpm.goreleaser.com/
MIT License
2.16k stars 158 forks source link

Prerelease version using env #724

Closed cacack closed 1 year ago

cacack commented 1 year ago

What happened?

Using env variables to set the package version with a pre-release specifier, nfpm doesn't create a valid version specifier for Alpine packages as documented here: https://wiki.alpinelinux.org/wiki/Package_policies.

Alpha, release candidates (rc2), etc are prefixed with underscore not a hyphen.

I'd expect the package version to be 1.6.0_rc but instead it is 1.6.0rc

❯ PKG_VERSION="1.6.0-rc" nfpm package --packager apk --config nfpm.yaml --target ./  
using apk packager...
created package: test_1.6.0rc_x86_64.apk

❯ grep pkgver .PKGINFO 
pkgver = 1.6.0rc

How can we reproduce this?

touch dummy
❯ cat nfpm.yaml 
name: "test"
version: "${PKG_VERSION}"
contents:
  - src: ./dummy
    dst: /usr/local/bin/dummy
❯ PKG_VERSION="1.6.0-rc" nfpm package --packager apk --config nfpm.yaml --target ./  
using apk packager...
created package: test_1.6.0rc_x86_64.apk

nfpm version

❯ nfpm --version
       _____ ____  __  __
 _ __ |  ___|  _ \|  \/  |
| '_ \| |_  | |_) | |\/| |
| | | |  _| |  __/| |  | |
|_| |_|_|   |_|   |_|  |_|
nfpm: a simple and 0-dependencies deb, rpm, apk and arch linux packager written in Go
https://nfpm.goreleaser.com

GitVersion:    2.33.1
GitCommit:     bb6d0b9839c71ebd5d9d9bc0cf4088b3b933dc09
GitTreeState:  false
BuildDate:     2023-09-22T02:48:09Z
BuiltBy:       goreleaser
GoVersion:     go1.21.1
Compiler:      gc
ModuleSum:     h1:EkdAzZyVhAI9JC1vjmjjbmnNzyH1J6Cu4JCsA7YcQuc=
Platform:      darwin/arm64

Search

Code of Conduct

Additional context

Version is being computed using svu.

Thanks for providing two awesome tools!

cacack commented 1 year ago

Ultimately I may not care as I'm using tr in other make recipes to adjust the semantic version to the package specific version. I haven't gotten to the point of consuming the APK from our repo to know if apk itself cares; I suspect it may throw off it's version graph but we rarely produce pre-release versions internally so 🤷 .

caarlos0 commented 1 year ago

can you check #725

thanks for the issue btw :D