Repository: goreleaser/nfpm (go)

Issue:
archlinux packager doesn't use `prerelease` option
### What happened?

The `prerelease` option in the config is completely unused by the `archlinux` packager. I expected it to show up in the version number, like it does with the `deb` packager.

### How can we reproduce this?

nfpm.yaml:

```yml
name: foo
version: 1.2.3
prerelease: beta1
maintainer: asdf
arch: amd64
contents: []
```

run:

```console
$ nfpm package -p archlinux
using archlinux packager...
created package: foo-1.2.3-1-x86_64.pkg.tar.zst
$ tar xf foo-1.2.3-1-x86_64.pkg.tar.zst .PKGINFO
$ cat .PKGINFO 
# Generated by nfpm
pkgname = foo
builddate = 1668647593
packager = Unknown Packager
size = 0
pkgbase = foo
pkgver = 1.2.3-1
pkgdesc = no description given
arch = x86_64
```


### nfpm version

```bash
nfpm version nfpm version 2.22.0
commit: 5c3cc38943f1743bcaeb422c2dc65555fc9b12a1
built at: 2022-11-12T03:50:16Z
built by: goreleaser
module version: v2.22.0, checksum: h1:TC6tuxxFq0hL0WapI63+CkLMbcsYRbR7kAnLkRYAEbo=
```


### Search

- [X] I did search for other open and closed issues before opening this.

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

### Additional context

_No response_

Pull request:
fix: archlinux prerelease
closes #577

Patch:
diff --git a/arch/arch.go b/arch/arch.go
index cd56132..c24eae3 100644
--- a/arch/arch.go
+++ b/arch/arch.go
@@ -72,7 +72,7 @@ func (ArchLinux) ConventionalFileName(info *nfpm.Info) string {
 	name := fmt.Sprintf(
 		"%s-%s-%d-%s.pkg.tar.zst",
 		info.Name,
-		info.Version,
+		info.Version+strings.ReplaceAll(info.Prerelease, "-", "_"),
 		pkgrel,
 		info.Arch,
 	)
@@ -411,7 +411,13 @@ func createPkginfo(info *nfpm.Info, tw *tar.Writer, totalSize int64) (*MtreeEntr
 	if info.Epoch != "" {
 		epoch, err := strconv.ParseUint(info.Epoch, 10, 64)
 		if err == nil {
-			pkgver = fmt.Sprintf("%d:%s-%d", epoch, info.Version, pkgrel)
+			pkgver = fmt.Sprintf(
+				"%d:%s%s-%d",
+				epoch,
+				info.Version,
+				strings.ReplaceAll(info.Prerelease, "-", "_"),
+				pkgrel,
+			)
 		}
 	}
 


Test patch:
diff --git a/arch/arch_test.go b/arch/arch_test.go
index c54e87c..aebaa98 100644
--- a/arch/arch_test.go
+++ b/arch/arch_test.go
@@ -21,6 +21,7 @@ func exampleInfo() *nfpm.Info {
 		Priority:    "extra",
 		Maintainer:  "Carlos A Becker <pkg@carlosbecker.com>",
 		Version:     "1.0.0",
+		Prerelease:  "beta-1",
 		Section:     "default",
 		Homepage:    "http://carlosbecker.com",
 		Vendor:      "nope",
@@ -120,7 +121,7 @@ func TestArchConventionalFileName(t *testing.T) {
 			info.Arch = arch
 			name := Default.ConventionalFileName(info)
 			require.Equal(t,
-				"foo-test-1.0.0-1-"+archToArchLinux[arch]+".pkg.tar.zst",
+				"foo-test-1.0.0beta_1-1-"+archToArchLinux[arch]+".pkg.tar.zst",
 				name,
 			)
 		})
@@ -180,7 +181,7 @@ func TestArchVersionWithEpoch(t *testing.T) {
 	pkginfoData, err := makeTestPkginfo(t, info)
 	require.NoError(t, err)
 	fields := extractPkginfoFields(pkginfoData)
-	require.Equal(t, "2:0.0.1-1", fields["pkgver"])
+	require.Equal(t, "2:0.0.1beta_1-1", fields["pkgver"])
 }
 
 func TestArchOverrideArchitecture(t *testing.T) {