From 2d0e9b7a93f459df7842c2edbbb02b8e313528f2 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Sun, 13 Oct 2024 11:28:30 +0100 Subject: [PATCH] Publish Docker images to GitHub Container Registry In addition to Docker Hub, publish fabric-nodeenv Docker images to GitHub Container Registry to improve availability. Also: - Remove redundant Azure Pipelines build definitions. - Update the Ubuntu image versions used for the build. Signed-off-by: Mark S. Lewis --- .editorconfig | 4 +- .github/workflows/release.yaml | 35 +- .github/workflows/test.yaml | 10 +- .github/workflows/vulnerability-scan.yaml | 2 +- ci/azure-pipelines.yml | 368 ---------------------- ci/templates/build-data.yaml | 24 -- ci/templates/nightly-version-update.yaml | 13 - ci/updatePackageJson.js | 24 -- 8 files changed, 26 insertions(+), 454 deletions(-) delete mode 100644 ci/azure-pipelines.yml delete mode 100644 ci/templates/build-data.yaml delete mode 100644 ci/templates/nightly-version-update.yaml delete mode 100644 ci/updatePackageJson.js diff --git a/.editorconfig b/.editorconfig index 45e3e40b4..ff2d3eb77 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,7 +23,9 @@ trim_trailing_whitespace = true insert_final_newline = true [*.md] -trim_trailing_whitespace = false +indent_size = 2 + +[*.{yaml,yml}] indent_size = 2 [*.{mj,cj,j,t}s] diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 54fa93ccf..06f004b30 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,21 +9,18 @@ on: - "v2.*" workflow_dispatch: -env: - DOCKER_REGISTRY: ${{ github.repository_owner == 'hyperledger' && 'docker.io' || 'ghcr.io' }} - jobs: test: uses: ./.github/workflows/test.yaml publishnpm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: test steps: - uses: actions/setup-node@v4 with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' + node-version: "18.x" + registry-url: "https://registry.npmjs.org" - uses: actions/download-artifact@v4 with: name: node-tgzs @@ -37,12 +34,17 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} publishdocker: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: test permissions: contents: read packages: write - + strategy: + fail-fast: false + matrix: + DOCKER_REGISTRY: + - "docker.io" + - "ghcr.io" steps: - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -50,30 +52,27 @@ jobs: uses: docker/setup-buildx-action@v3 with: buildkitd-flags: --debug - config-inline: | + buildkitd-config-inline: | [worker.oci] max-parallelism = 1 - name: Checkout uses: actions/checkout@v4 - - - name: Login to the ${{ env.DOCKER_REGISTRY }} Container Registry + - name: Login to the ${{ matrix.DOCKER_REGISTRY }} Container Registry uses: docker/login-action@v3 with: - registry: ${{ env.DOCKER_REGISTRY }} - username: ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }} - password: ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }} - + registry: ${{ matrix.DOCKER_REGISTRY }} + username: ${{ matrix.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }} + password: ${{ matrix.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }} - name: Docker meta id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository_owner }}/fabric-nodeenv + images: ${{ matrix.DOCKER_REGISTRY }}/${{ github.repository_owner }}/fabric-nodeenv tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}}.{{minor}}.{{patch}} - - - name: Build and push ${{ matrix.COMPONENT }} Image + - name: Build and push image id: push uses: docker/build-push-action@v5 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6c6d4243e..36ae6e59f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -8,7 +8,7 @@ on: jobs: setup: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 outputs: PACKAGE_VERSION: ${{ steps.builddata.outputs.PACKAGE_VERSION }} MINOR_PACKAGE_VERSION: ${{ steps.builddata.outputs.MINOR_PACKAGE_VERSION }} @@ -37,12 +37,12 @@ jobs: echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_OUTPUT build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: '18.x' + node-version: "18.x" - name: Install/Rebuild/UnitTest run: | set -xev @@ -74,13 +74,13 @@ jobs: path: fabric-nodeenv.tar.gz fvtest: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: build steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: '18.x' + node-version: "18.x" - uses: actions/download-artifact@v4 with: name: nodeenv-docker-image diff --git a/.github/workflows/vulnerability-scan.yaml b/.github/workflows/vulnerability-scan.yaml index 8bb11bf55..e075a8ad7 100644 --- a/.github/workflows/vulnerability-scan.yaml +++ b/.github/workflows/vulnerability-scan.yaml @@ -14,7 +14,7 @@ jobs: # Pulling in all the dependencies it will be able to run NPM AUDIT, and if that returns a # error code the job will fail. scan: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml deleted file mode 100644 index 69c631745..000000000 --- a/ci/azure-pipelines.yml +++ /dev/null @@ -1,368 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# fabric-chaincode-node azure pipeline configuration. -# -name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr) - -# Daily build for final quality -# cf https://crontab.guru/#0_23_*_*_* -schedules: - - cron: "0 10,12,14,16,23 * * *" - displayName: 'Chaincode Node Nightly Driver' - branches: - include: - - 'release-2.5' - -# Trigger on the main branch -# Standard Pull Request and Merge builds -# Any git tag will also trigger a build that should do publishing -trigger: - branches: - include: - - 'release-2.5' - tags: - include: - - '*' - - -# These are custom defined variables, the pipeline one is currently used for the build scripts -# to know to produce tests results in XML format for Azure to consume, for developers -# this isn't set so command line output is given -# -# Chaincode_Node_Vars is the protected group of keys for publishing -variables: - - group: Chaincode_Node_Vars - - name: component - value: fabric-chaincode-node - - name: pipeline - value: ci - - name: node_version_spec - value: '16.4.0' - - name: rewire_node_version_spec # see https://github.com/jhnns/rewire/issues/178 - value: '16.4.0' - - name: FABRIC_VERSION - value: 2.5 - -# Build on Ubuntu -pool: - vmImage: 'ubuntu-latest' - -# -# Publish to NPM on release builds (they are the github tagged releases) -# Publish to NPM on nightly builds when there is something to build -# the ids will be of the format 2.5.0.{commitid} -# -stages: - - # Primary stage of building, linting and unit tests - - stage: Build_and_Test - jobs: - # output some basic information for reference - - job: displayenv - steps: - - template: templates/build-data.yaml - - job: main - dependsOn: displayenv - displayName: 'Build, lint, UT' - variables: - VERSION: $[ dependencies.displayenv.outputs['BuildData.PACKAGE_VERSION'] ] - BUILD_DATE: $[ dependencies.displayenv.outputs['BuildData.BUILD_DATE'] ] - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(rewire_node_version_spec) - - template: templates/nightly-version-update.yaml - - script: | - set -ev - node common/scripts/install-run-rush.js install - displayName: 'Setup the rush environment' - - script: | - set -ev - node common/scripts/install-run-rush.js rebuild - displayName: 'Full rebuild' - - script: | - npx cobertura-merge -o merged_coverage.xml shim=./libraries/fabric-shim/coverage/cobertura-coverage.xml contractapi=./apis/fabric-contract-api/coverage/cobertura-coverage.xml -p - condition: or(succeeded(), failed()) - - task: PublishTestResults@2 - condition: or(succeeded(), failed()) # publish either way - inputs: - testResultsFiles: '**/test-results.xml' - artifactName: 'Unit Test results' - testRunTitle: 'Unit Test results' - - task: PublishCodeCoverageResults@1 - condition: or(succeeded(), failed()) # publish either way - inputs: - codeCoverageTool: 'cobertura' - summaryFileLocation: 'merged_coverage.xml' - artifactName: 'Unit Test Coverage' - - script: | - mkdir -p $(Build.ArtifactStagingDirectory)/logs - find . \( -type d -name 'node_modules' \) -prune -o -name '*.build*.log' -exec cp {} $(Build.ArtifactStagingDirectory)/logs \; - displayName: 'Copy build logs' - condition: or(succeeded(), failed()) # publish either way - - task: PublishBuildArtifacts@1 - condition: or(succeeded(), failed()) # publish either way - inputs: - pathToPublish: $(Build.ArtifactStagingDirectory)/logs - artifactName: 'Build logs' - displayName: 'Publish build logs' - - # Copy the built artifacts to the staging directory, tgz, and the docker image - - script: | - set -ev - node common/scripts/install-run-rush.js publish --include-all --pack --release-folder $(Build.ArtifactStagingDirectory)/tgz --publish - docker image save hyperledger/fabric-nodeenv | gzip > $(Build.ArtifactStagingDirectory)/fabric-nodeenv.tar.gz - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: $(Build.ArtifactStagingDirectory)/tgz - artifactName: node-tgz - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: $(Build.ArtifactStagingDirectory)/fabric-nodeenv.tar.gz - artifactName: nodeenv-docker-image - - # Run the FV tests but using the built material - - job: fvt - displayName: 'FV Tests' - dependsOn: [main,displayenv] - variables: - VERSION: $[ dependencies.displayenv.outputs['BuildData.PACKAGE_VERSION'] ] - BUILD_DATE: $[ dependencies.displayenv.outputs['BuildData.BUILD_DATE'] ] - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version_spec) - - template: templates/nightly-version-update.yaml - - task: DownloadPipelineArtifact@2 - inputs: - artifact: nodeenv-docker-image - path: $(Build.SourcesDirectory)/build - - task: DownloadPipelineArtifact@2 - inputs: - artifact: node-tgz - path: $(Build.SourcesDirectory)/build - - script: | - set -ev - ./tools/getEdgeDocker.sh # essential to get main docker images of peer etc. - docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv - docker tag hyperledger/fabric-nodeenv:latest hyperledger/fabric-nodeenv:$(FABRIC_VERSION) - docker images - node common/scripts/install-run-rush.js install - node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here - displayName: 'Get the latest main docker images' - - script: | - set -ev - export TLS=true - node common/scripts/install-run-rush.js start-fabric - node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images - docker images | grep hyperledger && docker ps -a - node common/scripts/install-run-rush.js test:fv --verbose - node common/scripts/install-run-rush.js test:e2e --verbose - displayName: 'FV Tests' - - - task: PublishTestResults@2 - condition: or(succeeded(), failed()) # publish either way - inputs: - testResultsFiles: '**/test-results.xml' - testRunTitle: 'FV Test results' - - task: CopyFiles@2 - condition: or(succeeded(), failed()) # publish either way - inputs: - sourceFolder: $(Build.SourcesDirectory)/test - contents: | - **/*.build*.log - !**/node_modules/** - targetFolder: $(Build.ArtifactStagingDirectory)/testlogs - - script: | - mkdir -p $(Build.ArtifactStagingDirectory)/testlogs - find . \( -type d -name 'node_modules' \) -prune -o -name '*.build*.log' -exec cp {} $(Build.ArtifactStagingDirectory)/testlogs \; - condition: or(succeeded(), failed()) - displayName: 'Copy test logs' - - task: PublishBuildArtifacts@1 - condition: or(succeeded(), failed()) # publish either way - inputs: - pathToPublish: $(Build.ArtifactStagingDirectory)/testlogs - artifactName: 'Test logs' - displayName: 'Publish test logs' - - - # Job to handle the auditing of the code - # NPM audit is run on a 'fake' installation of the libraries - # Pulling in all the dependencies it will be able to run NPM AUDIT, and if that returns a - # error code the job will fail. - - job: src_audit - displayName: 'Node Module Auditing' - dependsOn: [main,displayenv] - variables: - VERSION: $[ dependencies.displayenv.outputs['BuildData.PACKAGE_VERSION'] ] - BUILD_DATE: $[ dependencies.displayenv.outputs['BuildData.BUILD_DATE'] ] - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version_spec) - - task: DownloadPipelineArtifact@2 - inputs: - artifact: node-tgz - path: $(Build.SourcesDirectory)/build - - template: templates/nightly-version-update.yaml - - script: | - node common/scripts/install-run-rush.js install - node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images - mkdir -p $(Build.SourcesDirectory)/audit && cd $(Build.SourcesDirectory)/audit && npm init -y - npm install --registry http://localhost:4873 fabric-shim fabric-shim-api fabric-contract-api --save - npm audit --audit-level=moderate - displayName: 'Run npm audit' - - # Build and publish API docs on every merge build - - job: jsdoc - dependsOn: displayenv - condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI')) - variables: - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: - jsdoc_release: main - ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/main') }}: - jsdoc_release: $[format('release-{0}',dependencies.displayenv.outputs['BuildData.MINOR_PACKAGE_VERSION'])] - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version_spec) - - script: | - set -ev - node common/scripts/install-run-rush.js install - displayName: 'Setup the rush environment' - - script: | - set -ev - node common/scripts/install-run-rush.js rebuild --to fabric-shim-docs - displayName: 'Build JSDoc' - - task: CopyFiles@2 - inputs: - contents: | - gen/** - sourceFolder: '$(Build.SourcesDirectory)/docs' - targetFolder: $(Build.ArtifactStagingDirectory)/jsdoc - cleanTargetFolder: true - displayName: 'Copy JSDoc' - - task: CopyFiles@2 - condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') - inputs: - contents: | - _config.yml - **/?(*.md|*.html) - !_jsdoc.json - !_jsdoc/** - !gen/** - !node_modules/** - sourceFolder: '$(Build.SourcesDirectory)/docs' - targetFolder: $(Build.ArtifactStagingDirectory)/gh-pages - cleanTargetFolder: true - displayName: 'Copy gh-pages doc (main branch only)' - - script: | - git reset --hard HEAD - git clean -xdf - git fetch origin - git checkout -b gh-pages origin/gh-pages - git clean -xdf - - mkdir -p $(jsdoc_release)/api - rm -rf $(jsdoc_release)/api/* - cp -r $(Build.ArtifactStagingDirectory)/jsdoc/gen/* $(jsdoc_release)/api - if [ -d $(Build.ArtifactStagingDirectory)/gh-pages ]; then - find . -maxdepth 1 ! \( -name [.]* -o -name 'gh-pages' -o -name 'main' -o -name 'release-*' \) -exec rm -rf {} \; - cp -r $(Build.ArtifactStagingDirectory)/gh-pages/* . - fi - displayName: 'Update gh-pages branch' - - script: | - git config --global user.email "hlfdev.azp@gmail.com" - git config --global user.name "Hyperledger Bot" - git add -A - git commit -m "Publishing GitHub Pages" - git push https://$(GITHUB-PAT)@github.com/hyperledger/fabric-chaincode-node.git gh-pages - displayName: 'Commit gh-pages changes' - continueOnError: true # Need to fix jsdoc publishing after release - - # Publish a new version, triggered by a git tag - - stage: Publish_tag - dependsOn: Build_and_Test - condition: and(succeeded('Build_and_Test'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) - jobs: - - job: npm_publish - displayName: 'npm publish' - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version_spec) - - download: current - artifact: node-tgz - - script: | - touch $(Agent.TempDirectory)/.npmrc - echo '##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(Agent.TempDirectory)/.npmrc' - displayName: 'create user .npmrc file' - - script: | - npm config set registry https://registry.npmjs.org/ - npm config ls - displayName: 'set npmjs registry' - - task: npmAuthenticate@0 - inputs: - workingFile: '$(Agent.TempDirectory)/.npmrc' - customEndpoint: 'fabric-chainode-node-npm' - - script: | - find $(Pipeline.Workspace)/node-tgz/ -maxdepth 1 -type f -name 'fabric-*.tgz' -exec npm publish {} --tag beta \; - displayName: 'npm publish' - - job: dockerhub_publish - steps: - - template: templates/build-data.yaml - - task: DownloadPipelineArtifact@2 - inputs: - artifact: nodeenv-docker-image - path: $(Build.SourcesDirectory)/build - - - script: | - wget -qO "$PWD/manifest-tool" https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64 - chmod +x ./manifest-tool - - docker image load --input build/fabric-nodeenv.tar.gz - docker images - docker login ${DOCKER_REGISTRY_URL} --username=${DOCKER_REGISTRY_USERNAME} --password=${DOCKER_REGISTRY_PASSWORD} - echo "Logged in to docker registry" - # tag nodeenv image to PACKAGE_VERSION - docker tag hyperledger/fabric-nodeenv hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION) - # push nodeenv to repository - docker push hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION) - # publish patch version (3-digit) image - ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)" --target "hyperledger/fabric-nodeenv:$(BuildData.PACKAGE_VERSION)" - # publish minor version (2-digit) image - ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-nodeenv:amd64-$(BuildData.PACKAGE_VERSION)" --target "hyperledger/fabric-nodeenv:$(BuildData.MINOR_PACKAGE_VERSION)" - env: - DOCKER_REGISTRY_USERNAME: $(DockerHub-Username) - DOCKER_REGISTRY_PASSWORD: $(DockerHub-Password) - - # Stage to publish the nightly drivers - - stage: Publish_tag_nightly - dependsOn: Build_and_Test - condition: and(succeeded('Build_and_Test'), eq(variables['Build.Reason'], 'Schedule')) # only run on the scheduled builds - jobs: - - job: npm_publish - displayName: 'npm publish' - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version_spec) - - download: current - artifact: node-tgz - - script: | - touch $(Agent.TempDirectory)/.npmrc - echo '##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(Agent.TempDirectory)/.npmrc' - displayName: 'create user .npmrc file' - - script: | - npm config set registry https://registry.npmjs.org/ - npm config ls - displayName: 'set npmjs registry' - - task: npmAuthenticate@0 - inputs: - workingFile: '$(Agent.TempDirectory)/.npmrc' - customEndpoint: 'fabric-chainode-node-npm' - - script: | - find $(Pipeline.Workspace)/node-tgz/ -maxdepth 1 -type f -name 'fabric-*.tgz' -exec npm publish {} --tag beta \; - displayName: 'npm publish' \ No newline at end of file diff --git a/ci/templates/build-data.yaml b/ci/templates/build-data.yaml deleted file mode 100644 index 23bdb0307..000000000 --- a/ci/templates/build-data.yaml +++ /dev/null @@ -1,24 +0,0 @@ -steps: -- script: | - #!/bin/bash - set -ex -o pipefail - - env | sort - - # handle full version number - VERSION=$(jq '.version' $(Build.SourcesDirectory)/docker/fabric-nodeenv/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/") - echo Current version in code is :${VERSION}: - echo "##vso[task.setvariable variable=PACKAGE_VERSION;isOutput=true]${VERSION}" - - # handle minor version - MINOR_VERSION=$(jq '.version' $(Build.SourcesDirectory)/docker/fabric-nodeenv/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9])\.[0-9]?[0-9].*/\1/") - echo Current minor version in code is :${MINOR_VERSION}: - echo "##vso[task.setvariable variable=MINOR_PACKAGE_VERSION;isOutput=true]${MINOR_VERSION}" - - # get the current date for using in dev builds - BUILD_DATE=$(date '+%Y%m%d') - echo Build date is :${BUILD_DATE} - echo "##vso[task.setvariable variable=BUILD_DATE;isOutput=true]${BUILD_DATE}" - - name: BuildData - displayName: 'Build data' \ No newline at end of file diff --git a/ci/templates/nightly-version-update.yaml b/ci/templates/nightly-version-update.yaml deleted file mode 100644 index 959429885..000000000 --- a/ci/templates/nightly-version-update.yaml +++ /dev/null @@ -1,13 +0,0 @@ -steps: -- script: | - set -ev - export RELEASE_VERSION=${VERSION}-dev-${DATE_STAMP} - find . \( -wholename "./docs/package.json" -or -wholename "./apis/**/package.json" -or -wholename "./libraries/**/package.json" -or -wholename "./test/**/package.json" \) -exec node ci/updatePackageJson.js {} \; - node common/scripts/install-run-rush.js update - name: UpdateVersionNightlyDrivers - displayName: 'Update Version for dev drivers' - condition: and(succeeded(), eq(variables['Build.Reason'], 'Schedule')) # only run on the scheduled builds - env: - COMMIT_ID: $(Build.SourceVersion) - VERSION: $(VERSION) - DATE_STAMP: $(BUILD_DATE) \ No newline at end of file diff --git a/ci/updatePackageJson.js b/ci/updatePackageJson.js deleted file mode 100644 index c6afbe896..000000000 --- a/ci/updatePackageJson.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright IBM Corp. All Rights Reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -const fs = require('fs'); -let filename = process.argv[2]; -let input = JSON.parse(fs.readFileSync(filename)); -let ver = process.env.RELEASE_VERSION; - -// don't want to update the main package.json version for the 'fake' test contracts -// only the dependencies -if (!filename.match(/\/test\//g)){ - input.version = ver; -} - -if (input.dependencies) { - if (input.dependencies['fabric-contract-api']) input.dependencies['fabric-contract-api'] = ver; - if (input.dependencies['fabric-ledger']) input.dependencies['fabric-ledger'] = ver; - if (input.dependencies['fabric-shim']) input.dependencies['fabric-shim'] = ver; - if (input.dependencies['fabric-shim-api']) input.dependencies['fabric-shim-api'] = ver; -} -fs.writeFileSync(filename, JSON.stringify(input, null, 2));