1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-03 00:57:43 +02:00

feat: sign with env and output certificate (#2662)

* feat: sign with env and output certificate

* fix: test

* fix: prop name

* test: blob upload

* test: http upload

* test: exec

* test: sign
This commit is contained in:
Carlos Alexandro Becker
2021-11-11 22:56:03 -03:00
committed by GitHub
parent 52cf951c30
commit 312e52a760
19 changed files with 314 additions and 77 deletions

View File

@ -58,10 +58,14 @@ func TestMinioUpload(t *testing.T) {
tgzpath := filepath.Join(folder, "bin.tar.gz")
debpath := filepath.Join(folder, "bin.deb")
checkpath := filepath.Join(folder, "check.txt")
sigpath := filepath.Join(folder, "f.sig")
certpath := filepath.Join(folder, "f.pem")
require.NoError(t, os.WriteFile(checkpath, []byte("fake checksums"), 0o744))
require.NoError(t, os.WriteFile(srcpath, []byte("fake\nsrc"), 0o744))
require.NoError(t, os.WriteFile(tgzpath, []byte("fake\ntargz"), 0o744))
require.NoError(t, os.WriteFile(debpath, []byte("fake\ndeb"), 0o744))
require.NoError(t, os.WriteFile(sigpath, []byte("fake\nsig"), 0o744))
require.NoError(t, os.WriteFile(certpath, []byte("fake\ncert"), 0o744))
ctx := context.New(config.Project{
Dist: folder,
ProjectName: "testupload",
@ -86,6 +90,22 @@ func TestMinioUpload(t *testing.T) {
Name: "checksum.txt",
Path: checkpath,
})
ctx.Artifacts.Add(&artifact.Artifact{
Type: artifact.Signature,
Name: "checksum.txt.sig",
Path: sigpath,
Extra: map[string]interface{}{
artifact.ExtraID: "foo",
},
})
ctx.Artifacts.Add(&artifact.Artifact{
Type: artifact.Certificate,
Name: "checksum.pem",
Path: certpath,
Extra: map[string]interface{}{
artifact.ExtraID: "foo",
},
})
ctx.Artifacts.Add(&artifact.Artifact{
Type: artifact.UploadableSourceArchive,
Name: "source.tar.gz",
@ -119,6 +139,8 @@ func TestMinioUpload(t *testing.T) {
"testupload/v1.0.0/bin.deb",
"testupload/v1.0.0/bin.tar.gz",
"testupload/v1.0.0/checksum.txt",
"testupload/v1.0.0/checksum.txt.sig",
"testupload/v1.0.0/checksum.pem",
"testupload/v1.0.0/source.tar.gz",
"testupload/v1.0.0/file.golden",
})