From 6b580ececa428dc1349d17b80b8466d450666751 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Wed, 5 Jul 2023 16:31:29 -0400 Subject: [PATCH 1/6] Update goreleaser config Signed-off-by: Nicko Guyer --- .goreleaser.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 528df4e9..72ccb0ee 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -28,19 +28,23 @@ builds: ldflags: - "-s -w -X 'github.com/hyperledger/firefly-cli/cmd.BuildVersionOverride={{.Version}}' -X 'github.com/hyperledger/firefly-cli/cmd.BuildDate={{.Date}}' -X 'github.com/hyperledger/firefly-cli/cmd.BuildCommit={{.Commit}}'" archives: - - replacements: - darwin: macOS - linux: Linux - amd64: x86_64 + - name_template: >- + {{ .ProjectName }}_ + {{- if eq .Os "darwin" }}macOS + {{- else if eq .Arch "linux" }}Linux + {{- else }}{{ .Os }}{{ end }} + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} checksum: - name_template: 'checksums.txt' + name_template: "checksums.txt" snapshot: name_template: "{{ incpatch .Tag }}-next" changelog: sort: asc filters: exclude: - - '^docs:' - - '^test:' + - "^docs:" + - "^test:" release: - prerelease: auto \ No newline at end of file + prerelease: auto From 4ebc22d34e6a126ee886bc949919fa7d0e0fdf66 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Wed, 5 Jul 2023 16:39:09 -0400 Subject: [PATCH 2/6] Use consistent goreleaser archive names Signed-off-by: Nicko Guyer --- .goreleaser.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 72ccb0ee..3e8ff88e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -32,9 +32,8 @@ archives: {{ .ProjectName }}_ {{- if eq .Os "darwin" }}macOS {{- else if eq .Arch "linux" }}Linux - {{- else }}{{ .Os }}{{ end }} + {{- else }}{{ .Os }}{{ end }}_ {{- if eq .Arch "amd64" }}x86_64 - {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} checksum: name_template: "checksums.txt" From 40da3736aa21540daee918ade007f32da84e61e2 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Wed, 5 Jul 2023 16:42:34 -0400 Subject: [PATCH 3/6] Use consistent goreleaser archive names Signed-off-by: Nicko Guyer --- .goreleaser.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 3e8ff88e..e5fe6520 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -30,8 +30,9 @@ builds: archives: - name_template: >- {{ .ProjectName }}_ + {{ .Version }}_ {{- if eq .Os "darwin" }}macOS - {{- else if eq .Arch "linux" }}Linux + {{- else if eq .Os "linux" }}Linux {{- else }}{{ .Os }}{{ end }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else }}{{ .Arch }}{{ end }} From 96c2b327cd2c235f790f773be0f5756b7fe27e36 Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Wed, 5 Jul 2023 16:50:48 -0400 Subject: [PATCH 4/6] Use consistent goreleaser archive names Signed-off-by: Nicko Guyer --- .goreleaser.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index e5fe6520..2ac8de1b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -29,8 +29,7 @@ builds: - "-s -w -X 'github.com/hyperledger/firefly-cli/cmd.BuildVersionOverride={{.Version}}' -X 'github.com/hyperledger/firefly-cli/cmd.BuildDate={{.Date}}' -X 'github.com/hyperledger/firefly-cli/cmd.BuildCommit={{.Commit}}'" archives: - name_template: >- - {{ .ProjectName }}_ - {{ .Version }}_ + {{ .ProjectName }}_{{ .Version }}_ {{- if eq .Os "darwin" }}macOS {{- else if eq .Os "linux" }}Linux {{- else }}{{ .Os }}{{ end }}_ From 6af268630444efe875957f7eb83bdc9af7e595fd Mon Sep 17 00:00:00 2001 From: Nicko Guyer Date: Wed, 5 Jul 2023 16:53:01 -0400 Subject: [PATCH 5/6] Update to goreleaser-action@v4 Signed-off-by: Nicko Guyer --- .github/workflows/build.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6af2a89f..78ccc676 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: branches: - main tags: - - 'v*' + - "v*" pull_request: permissions: @@ -15,22 +15,19 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v3 with: fetch-depth: 0 - - - name: Set up Go + - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.18 - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 with: distribution: goreleaser version: latest args: release --rm-dist env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 13d6d3cfc6c07ee494d39fe6c64a3c98368468bc Mon Sep 17 00:00:00 2001 From: Jim Zhang Date: Thu, 17 Aug 2023 15:22:52 -0400 Subject: [PATCH 6/6] Parse the chaincode name from the label to compare Signed-off-by: Jim Zhang --- internal/blockchain/fabric/fabric_provider.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/blockchain/fabric/fabric_provider.go b/internal/blockchain/fabric/fabric_provider.go index b2d0529d..97fb51d6 100644 --- a/internal/blockchain/fabric/fabric_provider.go +++ b/internal/blockchain/fabric/fabric_provider.go @@ -26,6 +26,7 @@ import ( "os" "path" "path/filepath" + "regexp" "github.com/hyperledger/firefly-cli/internal/blockchain/fabric/fabconnect" "github.com/hyperledger/firefly-cli/internal/docker" @@ -543,7 +544,9 @@ func (p *FabricProvider) DeployContract(filename, contractName, instanceName str chaincodeInstalled := false packageID := "" for _, installedChaincode := range res.InstalledChaincodes { - if installedChaincode.Label == chaincode { + validLabel := regexp.MustCompile(`^([^_]+)_.+$`) + matches := validLabel.FindStringSubmatch(installedChaincode.Label) + if len(matches) > 0 && matches[1] == chaincode { chaincodeInstalled = true packageID = installedChaincode.PackageID break