mirror of
https://github.com/goreleaser/nfpm
synced 2026-11-19 19:54:22 +01:00
* chore(deps): add go-msi and go-pkcs12
go.digitalxero.dev/go-msi is the pure-Go Windows Installer database
writer, validator, reader and Authenticode signer behind the new msi
packager; go-pkcs12 becomes a direct dependency for the signing tests.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Hnro326ZTAu2EqUTGGkCB
* feat: add msi support
Adds an `msi` packager that writes a real Windows Installer database with
the pure-Go go-msi library: contents are mapped onto the standard Windows
folders (everything else under the product's Program Files folder), root
metadata (description, homepage, license, vendor/maintainer, scripts) is
reused where MSI has a place for it, and advertised shortcuts, Windows
services, registry values, per-user installs and Authenticode signing are
exposed under `msi:`.
Every release replaces older installs of the same upgrade code in place:
the upgrade code and component GUIDs are derived from identities that
survive releases, while the product code follows the full version. A
version Windows Installer cannot represent is an error rather than a
silently clamped (and colliding) one.
Maintainer scripts run as elevated deferred custom actions embedded in the
package so they work before any file is installed and after every file is
removed; they are extracted to a randomly named, freshly created file
since the SYSTEM temp directory is world-writable.
Unit tests build real packages, run go-msi's ICE validator and assert on
the decoded tables; golden GUIDs pin the derivation contract. The
acceptance suite installs, exercises, upgrades and removes the package
with msiexec on a Windows runner and proves a failing script rolls back.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Hnro326ZTAu2EqUTGGkCB
* ci: validate nfpm-signed MSI on real Windows
Build and Authenticode-sign the MSI on Linux with nfpm's pure-Go signer
and a throwaway openssl certificate, then validate the signature with the
real Windows trust stack (Get-AuthenticodeSignature, signtool verify) and
install, exercise and remove it with msiexec on a Windows runner. The
unsigned msi-windows-install job remains as the control.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Hnro326ZTAu2EqUTGGkCB
* chore(deps): update go-msi to latest main
* Revert "chore(deps): update go-msi to latest main"
This reverts commit 05aaa91684.
* ci: integrate MSI validation with merge queue checks
* fix(msi): decode quoted maintainer names
* fix: preserve address-only maintainer fallback
* fix(msi): update go-msi and support explicit file versions
Pin the latest upstream fixes for string references, column limits, and PE version detection. Expose per-destination file version overrides so intentionally unversioned Go binaries can still be packaged, and update fixtures, docs, and schema.
* chore(deps): pin go-msi v0.5.1 release
* fix(msi): Correct downgrade removal and shortcut resources
Match Windows destinations without case sensitivity, reuse PE icon streams by source and target extension, and cover newer products in downgrade removal ranges.
Add table regressions, native icon extraction and ICE50 checks, and Windows downgrade acceptance with distinct payloads. Run MSI installation checks on pull requests.
See #1097
* test(msi): Correct native icon extraction assertions
Distinguish one RT_GROUP_ICON resource from the two extracted icon handles requested from the Windows shell. Preserve checks for both handles and cover malformed resource directories and extensionless icon targets.
See #1097
* fix(msi): Adopt go-msi v0.5.2 and reject install-path aliases
Use the released dependency fixes for downgrade sequencing, non-elevating per-user packages, and lossless non-ASCII summary metadata. Preserve the explicit removal rule for allowed downgrades.
Reject duplicate resolved installation targets while preserving GUID identities. Add downstream table regressions and native silent-downgrade and standard-user Unicode/script verification.
See #1097
* fix(msi): Adopt go-msi v0.5.3 and close authoring gaps
* test(msi): Normalize redirected native install paths
* fix(msi): Preserve upgrade targets and release artifacts
* fix(msi): Adopt go-msi v0.5.5 signing and AppSearch fixes
* fix(msi): expand remaining strings and prove hook rollback
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
package cmd_test
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
goversion "github.com/caarlos0/go-version"
|
|
"github.com/goreleaser/nfpm/v2"
|
|
"github.com/goreleaser/nfpm/v2/files"
|
|
"github.com/goreleaser/nfpm/v2/internal/cmd"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"go.yaml.in/yaml/v3"
|
|
)
|
|
|
|
func TestMSIReleaseArtifactsDoNotOverwrite(t *testing.T) {
|
|
dir := t.TempDir()
|
|
payload := filepath.Join(t.TempDir(), "payload")
|
|
require.NoError(t, os.WriteFile(payload, []byte("payload"), 0o600))
|
|
configFile := filepath.Join(t.TempDir(), "nfpm.yaml")
|
|
config := nfpm.Config{Info: nfpm.Info{
|
|
Name: "artifact", Arch: "amd64", Vendor: "Vendor",
|
|
Overridables: nfpm.Overridables{Contents: files.Contents{{Source: payload, Destination: "/app.bin"}}},
|
|
}}
|
|
var firstPath string
|
|
var firstBytes []byte
|
|
for _, version := range []string{"1.2.3-rc1", "1.2.3"} {
|
|
config.Version = version
|
|
data, err := yaml.Marshal(config)
|
|
require.NoError(t, err)
|
|
require.NoError(t, os.WriteFile(configFile, data, 0o600))
|
|
cmd.Execute(goversion.Info{}, func(code int) { assert.Zero(t, code) },
|
|
[]string{"pkg", "--config", configFile, "--packager", "msi", "--target", dir})
|
|
matches, err := filepath.Glob(filepath.Join(dir, "*.msi"))
|
|
require.NoError(t, err)
|
|
if firstPath == "" {
|
|
require.Len(t, matches, 1)
|
|
firstPath = matches[0]
|
|
firstBytes, err = os.ReadFile(firstPath)
|
|
require.NoError(t, err)
|
|
} else {
|
|
require.Len(t, matches, 2)
|
|
after, err := os.ReadFile(firstPath)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, firstBytes, after)
|
|
}
|
|
}
|
|
}
|