Skip to content

chore(release): publish v2.2.0 #21

chore(release): publish v2.2.0

chore(release): publish v2.2.0 #21

name: all-nodejs-packages-publish
env:
NODEJS_VERSION: v18.18.2
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
GIT_TAG_TO_PUBLISH:
description: 'The specific git tag to publish'
required: false
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-publish-packages:
runs-on: ubuntu-22.04
permissions:
id-token: write
steps:
- name: Check Version Format in Tag
uses: nowsprinting/check-version-format-action@8678d594eeed2666b105eca0253f77c5eae94e5a #v4.0.5
id: version
with:
prefix: 'v'
- name: Fail if version is invalid
if: steps.version.outputs.is_valid != 'true'
run: |
echo "Error: Tag '${{ github.ref_name }}' is not a valid semantic version."
exit 1
- name: Print Workflow inputs.GIT_TAG_TO_PUBLISH
run: |
echo "inputs.GIT_TAG_TO_PUBLISH=${{ inputs.GIT_TAG_TO_PUBLISH }}"
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
with:
ref: ${{ inputs.GIT_TAG_TO_PUBLISH }}
- run: git fetch --unshallow --prune
- run: git status --long --verbose
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b #v4.0.3
with:
always-auth: true
node-version: ${{ env.NODEJS_VERSION }}
registry-url: "https://registry.npmjs.org/"
scope: "@hyperledger"
- run: cat /home/runner/work/_temp/.npmrc
- name: ./tools/ci.sh
run: ./tools/ci.sh
env:
DEV_BUILD_DISABLED: false
FULL_BUILD_DISABLED: false
JEST_TEST_RUNNER_DISABLED: true
TAPE_TEST_RUNNER_DISABLED: true
- name: Check npm whoami with --registry set to npmjs
continue-on-error: true
run: npm whoami --registry=https://registry.npmjs.org/
- name: lerna-publish-npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: |
npm whoami
yarn lerna publish from-git --yes --loglevel=debug --ignore-scripts
- run: cat /home/runner/work/_temp/.npmrc
# Reset the .npmrc by deleting it. Invoking the setup-node action again below
# will set it up from scratch again but with a different registry configuration
# so that we can publish to both registries instead of having to choose.
- run: rm /home/runner/work/_temp/.npmrc
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b #v4.0.3
with:
always-auth: true
node-version: ${{ env.NODEJS_VERSION }}
registry-url: "https://npm.pkg.github.com/"
scope: "@{{ github.repository_owner }}"
- run: cat /home/runner/work/_temp/.npmrc
# Re-initialize the registries so that the @iroha2 scope gets configured in .npmrc
- run: yarn run init-registries
- run: cat /home/runner/work/_temp/.npmrc
- name: Check npm whoami with no --registry parameter.
continue-on-error: true
run: npm whoami
- name: Check npm whoami with --registry set to GHCR
continue-on-error: true
run: npm whoami --registry=https://npm.pkg.github.com/
- name: Configure git user and email
run: |
git config --global user.email "npm-ci@${{ github.repository_owner }}.org"
git config --global user.name "hyperledger-ghci"
# We run the publish script a second time after having reconfigured the registry to be GHCR
# instead of npmjs.org so that we can publish the packages everywhere.
- name: lerna-publish-ghcr
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn lerna publish from-git --yes --loglevel=debug --ignore-scripts