mirror of
https://github.com/goreleaser/nfpm
synced 2026-12-01 10:55:41 +01:00
* chore(deps): bump go-msix to v1.0.1 and go-pkcs12 to v0.7.3 go-msix v1.0.1 carries the Authenticode signing fixes needed for packages signed on Linux to validate on Windows; 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(msix): default publisher from the signing certificate or vendor `msix.publisher` is no longer required. When signing is configured it defaults to the certificate subject, which Windows requires to byte-match on signed packages; otherwise it becomes a CN= distinguished name built from the root vendor, falling back to the maintainer name (with RFC 2253 escaping). `publisher_display_name` prefers vendor/maintainer over the package name, `$NFPM_PASSPHRASE` now also feeds the MSIX signer, and the root `scripts` block is reported as ignored instead of silently dropped. The vendor/maintainer fallback lives in internal/maintainer so the MSI packager can share it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Hnro326ZTAu2EqUTGGkCB * ci: validate nfpm-signed MSIX on real Windows Build and Authenticode-sign the MSIX 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 deploy it with Add-AppxPackage on a Windows runner. The existing signtool-signed job remains as the control, and the install script now also runs the installed executable. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Hnro326ZTAu2EqUTGGkCB * ci: integrate MSIX signature validation with merge queue checks * fix(msix): derive publishers using Windows DN syntax * fix: preserve address-only maintainer fallback * fix(msix): Preserve signing errors without publisher defaults Return the PFX loading failure before publisher validation when no vendor or maintainer fallback exists. Cover corrupt and missing PFX files and incorrect passphrases with and without fallback metadata. * test(msix): Remove duplicate publisher display name test * fix(msix): Validate publisher defaults and isolate signing attempts Reject unsupported certificate subjects and invalid publisher metadata. Keep derived identities local to each packaging attempt, load signing credentials once, and reject explicit certificate mismatches. Honor explicitly empty MSIX passphrases in the standard environment parsers. Cover signing retries, successful Info reuse, metadata boundaries, passwordless PFX files, and Windows SDK validation with signed positive and negative controls. * test(msix): Cover parser entry points and invalid certificate subjects * fix(msix): Match Windows T61 decoding and validate derived DNs Preserve certificate ASN.1 value tags and apply Windows UTF-8-first decoding for T.61 strings, with the existing 8-bit fallback. Pass vendor values through only when the complete value is a valid Windows DN; otherwise quote them as CN values. Cover raw T.61 subjects in native comparisons and signed packaging with derived and explicit publishers. Isolate the global-passphrase test from empty and nonempty ambient MSIX overrides. * fix(msix): Fall back for invalid derived display names --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
276 lines
10 KiB
YAML
276 lines
10 KiB
YAML
# https://taskfile.dev
|
|
|
|
version: "3"
|
|
|
|
env:
|
|
GO111MODULE: on
|
|
GOPROXY: https://proxy.golang.org,direct
|
|
|
|
tasks:
|
|
dev:
|
|
desc: Setup git hooks
|
|
cmds:
|
|
- git config core.hooksPath .githooks
|
|
|
|
setup:
|
|
desc: Install dependencies
|
|
cmds:
|
|
- go mod tidy
|
|
|
|
docker:setup:
|
|
desc: Setup Docker for multi-arch image builds
|
|
cmds:
|
|
- docker run --privileged --rm tonistiigi/binfmt --install all
|
|
|
|
build:
|
|
desc: Build the binary
|
|
sources:
|
|
- ./**/*.go
|
|
generates:
|
|
- ./nfpm
|
|
cmds:
|
|
- go build ./cmd/nfpm
|
|
|
|
acceptance:windows:package:
|
|
desc: Build packages for testing
|
|
vars:
|
|
SRC: "./testdata/acceptance/core.complex.yaml"
|
|
MSIX_SRC: "./testdata/acceptance/msix.basic.yaml"
|
|
cmds:
|
|
- mkdir -p ./dist
|
|
- go run ./cmd/nfpm/... pkg -f {{.SRC}} -p deb -t ./dist/foo.deb
|
|
- go run ./cmd/nfpm/... pkg -f {{.SRC}} -p rpm -t ./dist/foo.rpm
|
|
- go run ./cmd/nfpm/... pkg -f {{.SRC}} -p apk -t ./dist/foo.apk
|
|
- go run ./cmd/nfpm/... pkg -f {{.SRC}} -p archlinux -t ./dist/foo.pkg.tar.zst
|
|
- go run ./cmd/nfpm/... pkg -f {{.MSIX_SRC}} -p msix -t ./dist/foo.msix
|
|
|
|
acceptance:windows:install:
|
|
desc: Install packages built with package
|
|
cmds:
|
|
- docker run --rm --workdir /tmp -v $PWD/dist:/tmp fedora rpm --nosignature -ivh foo.rpm
|
|
- docker run --rm --workdir /tmp -v $PWD/dist:/tmp ubuntu dpkg -i foo.deb
|
|
- docker run --rm --workdir /tmp -v $PWD/dist:/tmp archlinux pacman --noconfirm -U foo.pkg.tar.zst
|
|
- docker run --rm --workdir /tmp -v $PWD/dist:/tmp alpine apk add --allow-untrusted foo.apk
|
|
|
|
acceptance:windows:package:msix:
|
|
desc: Build MSIX package for Windows install testing
|
|
platforms: [windows]
|
|
cmds:
|
|
- go build -o ./dist/testapp.exe ./testdata/acceptance/testapp/
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/create-test-cert.ps1
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msix.install.yaml -p msix -t ./dist/foo.msix
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/sign-msix.ps1
|
|
|
|
acceptance:windows:install:msix:
|
|
desc: Install and verify MSIX package on Windows
|
|
platforms: [windows]
|
|
cmds:
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/install-msix.ps1
|
|
|
|
acceptance:windows:package:msi:
|
|
desc: Build MSI package for Windows install testing
|
|
platforms: [windows]
|
|
cmds:
|
|
- mkdir -p ./dist
|
|
- go build -o ./dist/testapp.exe ./testdata/acceptance/testapp/
|
|
- go build -ldflags="-X=main.message=nfpm-msi-v2-test-ok" -o ./dist/testapp-newer.exe ./testdata/acceptance/testapp/
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.install.yaml -p msi -t ./dist/foo.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.upgrade.yaml -p msi -t ./dist/foo-upgrade.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.newer.yaml -p msi -t ./dist/foo-newer.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.downgrade.yaml -p msi -t ./dist/foo-downgrade.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.rollback.yaml -p msi -t ./dist/foo-rollback.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.user-latin.yaml -p msi -t ./dist/foo-user-latin.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.user-japanese.yaml -p msi -t ./dist/foo-user-japanese.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.user-cyrillic.yaml -p msi -t ./dist/foo-user-cyrillic.msi
|
|
- go run ./testdata/acceptance/msi-regressions/
|
|
|
|
acceptance:windows:install:msi:
|
|
desc: Install, upgrade, downgrade and remove MSI packages on Windows, and prove a failing script rolls back
|
|
platforms: [windows]
|
|
cmds:
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/install-msi.ps1 -Msi ./dist/foo.msi -Upgrade ./dist/foo-upgrade.msi -Newer ./dist/foo-newer.msi -Downgrade ./dist/foo-downgrade.msi -Rollback ./dist/foo-rollback.msi
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/verify-msi-regressions.ps1
|
|
|
|
acceptance:windows:install:msi:signed:
|
|
desc: Install, verify and remove the nfpm-signed MSI on Windows
|
|
platforms: [windows]
|
|
cmds:
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/install-msi.ps1 -Msi ./dist/foo.msi
|
|
|
|
acceptance:windows:install:msi:per-user:
|
|
desc: Verify Unicode metadata and install/remove MSI packages as a fresh standard user on a disposable Windows CI runner
|
|
platforms: [windows]
|
|
cmds:
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/verify-msi-per-user.ps1
|
|
|
|
acceptance:windows:package:signed:msi:
|
|
desc: Cross-compile the test app and build the nfpm-signed MSI package (runs on Linux/macOS)
|
|
env:
|
|
NFPM_MSI_PASSPHRASE: test123
|
|
cmds:
|
|
- mkdir -p ./dist
|
|
- ./testdata/acceptance/create-test-cert.sh
|
|
- GOOS=windows GOARCH=amd64 go build -o ./dist/testapp.exe ./testdata/acceptance/testapp/
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.install.yaml -p msi -t ./dist/foo-unsigned.msi
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msi.signed.yaml -p msi -t ./dist/foo.msi
|
|
|
|
acceptance:windows:verify:msi:signed:
|
|
desc: Trust the test cert and validate the nfpm-signed MSI with the real Windows trust stack
|
|
platforms: [windows]
|
|
cmds:
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/verify-signature.ps1 -Cert ./dist/test.cer -Signed ./dist/foo.msi -Unsigned ./dist/foo-unsigned.msi
|
|
|
|
acceptance:windows:package:signed:msix:
|
|
desc: Cross-compile the test app and build the nfpm-signed MSIX package (runs on Linux/macOS)
|
|
env:
|
|
NFPM_MSIX_PASSPHRASE: test123
|
|
cmds:
|
|
- mkdir -p ./dist
|
|
- ./testdata/acceptance/create-test-cert.sh
|
|
- GOOS=windows GOARCH=amd64 go build -o ./dist/testapp.exe ./testdata/acceptance/testapp/
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msix.install.yaml -p msix -t ./dist/foo-unsigned.msix
|
|
- go run ./cmd/nfpm/... pkg -f ./testdata/acceptance/msix.signed.yaml -p msix -t ./dist/foo.msix
|
|
|
|
acceptance:windows:verify:msix:signed:
|
|
desc: Trust the test cert and validate the nfpm-signed MSIX with the real Windows trust stack
|
|
platforms: [windows]
|
|
cmds:
|
|
- pwsh -ExecutionPolicy Bypass -File testdata/acceptance/verify-signature.ps1 -Cert ./dist/test.cer -Signed ./dist/foo.msix -Unsigned ./dist/foo-unsigned.msix
|
|
|
|
acceptance:pull:
|
|
desc: Pull acceptance test images
|
|
vars:
|
|
IMGS:
|
|
sh: grep FROM ./testdata/acceptance/*.dockerfile | cut -f2 -d' ' | grep -v min | grep -v test | sort | uniq
|
|
cmds:
|
|
- echo "{{.IMGS}}" | while read -r img; do docker pull $img; done
|
|
|
|
acceptance:
|
|
desc: Run acceptance tests
|
|
env:
|
|
LC_ALL: C
|
|
vars:
|
|
TEST_OPTIONS: '{{default "" .TEST_OPTIONS}}'
|
|
TEST_PATTERN: '{{default "." .TEST_PATTERN}}'
|
|
cmds:
|
|
- go test {{.TEST_OPTIONS}} -tags=acceptance -p 4 -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt acceptance_test.go -run {{.TEST_PATTERN}} -timeout=1h
|
|
|
|
test:
|
|
desc: Run unit tests
|
|
env:
|
|
LC_ALL: C
|
|
vars:
|
|
TEST_OPTIONS: '{{default "" .TEST_OPTIONS}}'
|
|
SOURCE_FILES: '{{default "./..." .SOURCE_FILES}}'
|
|
TEST_PATTERN: '{{default "." .TEST_PATTERN}}'
|
|
cmds:
|
|
- go test {{.TEST_OPTIONS}} -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt {{.SOURCE_FILES}} -run {{.TEST_PATTERN}} -timeout=5m
|
|
|
|
cover:
|
|
desc: Open the cover tool
|
|
cmds:
|
|
- go tool cover -html=coverage.txt
|
|
|
|
fmt:
|
|
desc: gofumpt all code
|
|
cmds:
|
|
- gofumpt -w -l .
|
|
|
|
ci:
|
|
desc: Run all CI steps
|
|
cmds:
|
|
- task: setup
|
|
- task: build
|
|
- task: test
|
|
- task: acceptance
|
|
|
|
default:
|
|
desc: Runs the default tasks
|
|
cmds:
|
|
- task: ci
|
|
|
|
schema:generate:
|
|
desc: Generate JSONSchema
|
|
cmds:
|
|
- go run ./cmd/nfpm/ schema -o ./www/static/schema.json
|
|
sources:
|
|
- nfpm.go
|
|
generates:
|
|
- ./www/static/schema.json
|
|
|
|
schema:validate:
|
|
desc: Validate JSONSchema
|
|
cmds:
|
|
- jv ./www/static/schema.json ./testdata/acceptance/*.yaml
|
|
sources:
|
|
- ./www/static/schema.json
|
|
- ./testdata/acceptance/*.yaml
|
|
|
|
docs:generate:
|
|
desc: Generate docs
|
|
cmds:
|
|
- ./scripts/cmd_docs.sh
|
|
sources:
|
|
- cmd/*.go
|
|
- files/*.go
|
|
- ./scripts/cmd_docs.sh
|
|
- CONTRIBUTING.md
|
|
generates:
|
|
- www/content/docs/cmd/*.md
|
|
- www/content/docs/contributing.md
|
|
|
|
docs:releases:
|
|
desc: Generate the latest file
|
|
cmds:
|
|
- ./scripts/pages/releases.sh
|
|
generates:
|
|
- www/static/latest
|
|
|
|
docs:imgs:
|
|
desc: Download and resize images
|
|
cmds:
|
|
- wget -O www/static/logo.png https://github.com/goreleaser/artwork/raw/master/goreleaserfundo.png
|
|
- wget -O www/static/favicon.svg https://raw.githubusercontent.com/goreleaser/artwork/refs/heads/master/goreleaser.svg
|
|
- convert www/static/logo.png -define icon:auto-resize=64,48,32,16 www/static/favicon.ico
|
|
- convert www/static/logo.png -resize x120 www/static/apple-touch-icon.png
|
|
- convert www/static/logo.png -resize x192 www/static/android-chrome-192x192.png
|
|
- convert www/static/logo.png -resize x512 www/static/android-chrome-512x512.png
|
|
- convert www/static/logo.png -resize x16 www/static/favicon-16x16.png
|
|
- convert www/static/logo.png -resize x32 www/static/favicon-32x32.png
|
|
|
|
docs:serve:
|
|
desc: Start documentation server
|
|
cmds:
|
|
- task: docs:generate
|
|
- cd www && hugo server --buildDrafts --bind 0.0.0.0 --port 8080
|
|
|
|
docs:build:
|
|
desc: Build docs
|
|
cmds:
|
|
- task: docs:generate
|
|
- cd www && hugo --minify
|
|
|
|
docs:test:
|
|
desc: Test docs with htmltest
|
|
cmds:
|
|
- task: docs:build
|
|
- htmltest www/public -c www/htmltest.yml
|
|
|
|
release:
|
|
desc: Create a new tag
|
|
vars:
|
|
NEXT:
|
|
sh: svu n
|
|
cmds:
|
|
- git tag {{.NEXT}}
|
|
- echo {{.NEXT}}
|
|
- git push origin --tags
|
|
|
|
release:watch:
|
|
vars:
|
|
RUN_ID:
|
|
sh: "gh run list --workflow=release.yml --limit 1 --json databaseId | jq -r '.[] | .databaseId'"
|
|
cmds:
|
|
- gh run watch {{.RUN_ID}}
|
|
- printf '\a'
|