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 }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 528df4e9..2ac8de1b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -28,19 +28,22 @@ 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 }}_{{ .Version }}_ + {{- if eq .Os "darwin" }}macOS + {{- else if eq .Os "linux" }}Linux + {{- else }}{{ .Os }}{{ end }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- 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 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