fix(ui-copy): add copy button and allow pasting (#4916) #13452
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CLI Publish & Verify | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - staging/** | |
| pull_request: | |
| merge_group: | |
| concurrency: | |
| group: verify-cli-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| should-run: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_skip: ${{ steps.check.outputs.should_skip }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| docs_only: | |
| - 'docs/**' | |
| non_docs: | |
| - '**' | |
| - '!docs/**' | |
| - name: Determine if should skip | |
| id: check | |
| run: | | |
| # Run on PRs only if not docs only | |
| # Always run on merge queue | |
| # Always run on direct pushes to master (not merge queue bot) | |
| IS_PR="${{ github.event_name == 'pull_request' }}" | |
| IS_MERGE_QUEUE="${{ github.event_name == 'merge_group' }}" | |
| IS_DIRECT_PUSH_TO_MASTER="${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.actor != 'github-merge-queue[bot]' }}" | |
| IS_DOCS_ONLY="${{ steps.filter.outputs.docs_only == 'true' && steps.filter.outputs.non_docs != 'true' }}" | |
| SHOULD_SKIP="true" | |
| # Always run on merge queue and direct push to master | |
| if [[ "$IS_MERGE_QUEUE" == "true" || "$IS_DIRECT_PUSH_TO_MASTER" == "true" ]]; then | |
| SHOULD_SKIP="false" | |
| # Run on PR only if not docs only | |
| elif [[ "$IS_PR" == "true" && "$IS_DOCS_ONLY" != "true" ]]; then | |
| SHOULD_SKIP="false" | |
| fi | |
| echo "should_skip=$SHOULD_SKIP" >> $GITHUB_OUTPUT | |
| publish: | |
| needs: should-run | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| GIT_HASH: ${{ steps.publish_step.outputs.hash }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| - uses: actions/setup-node@v4 | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| with: | |
| node-version-file: '.nvmrc' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@nangohq' | |
| always-auth: true | |
| - name: Build | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| run: | | |
| npm ci | |
| npm run ts-build | |
| - name: Publish packages to github registry so they can be bumped | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| function check_and_publish { | |
| PACKAGE_PATH=$1 | |
| PACKAGE_NAME=$(node -p "require('./${PACKAGE_PATH}/package.json').name") | |
| PACKAGE_VERSION=$(node -p "require('./${PACKAGE_PATH}/package.json').version") | |
| if npm view ${PACKAGE_NAME}@${PACKAGE_VERSION} ; then | |
| echo "Version ${PACKAGE_VERSION} of ${PACKAGE_NAME} already exists. Skipping publish." | |
| else | |
| echo "Publishing ${PACKAGE_NAME}@${PACKAGE_VERSION}..." | |
| pushd ./${PACKAGE_PATH} | |
| npm publish --ignore-scripts | |
| popd | |
| fi | |
| } | |
| check_and_publish packages/types | |
| check_and_publish packages/nango-yaml | |
| check_and_publish packages/providers | |
| check_and_publish packages/node-client | |
| check_and_publish packages/runner-sdk | |
| check_and_publish packages/frontend | |
| - id: publish_step | |
| name: Publish npm packages to the github registry | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| GIT_HASH=$(git rev-parse HEAD) | |
| echo "hash=${GIT_HASH}" >> "$GITHUB_OUTPUT" | |
| npx zx ./scripts/publish.mjs --version=0.0.1-$GIT_HASH --skip-cli | |
| - name: Publish the cli privately under the correct scope | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| working-directory: packages/cli | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| GIT_HASH=$(git rev-parse HEAD) | |
| npm version "0.0.1-$GIT_HASH" --no-git-tag-version --allow-same-version | |
| jq '.name = "@nangohq/cli"' package.json > temp.json && mv temp.json package.json | |
| npm publish | |
| verify: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - should-run | |
| - publish | |
| env: | |
| NANGO_CLI_UPGRADE_MODE: ignore | |
| GIT_HASH: ${{ needs.publish.outputs.GIT_HASH }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| with: | |
| node-version: '20.18.1' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@nangohq' | |
| always-auth: true | |
| - name: Install the cli from the github package registry | |
| if: needs.should-run.outputs.should_skip != 'true' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Install the cli from the github package registry | |
| npm install -g nango@npm:@nangohq/[email protected]$GIT_HASH | |
| VERSION_OUTPUT=$(npx nango version) | |
| EXPECTED_VERSION="Nango CLI version: 0.0.1-$GIT_HASH" | |
| [ "$VERSION_OUTPUT" = "$EXPECTED_VERSION" ] || { echo "Version mismatch. Expected: $EXPECTED_VERSION, got: $VERSION_OUTPUT"; exit 1; } | |
| # Test the cli by creating a new project and compiling it | |
| npx nango version --debug | |
| npx nango init nango-integrations --debug --copy | |
| cd nango-integrations | |
| # Install the cli from the github package registry | |
| npm i -ED nango@npm:@nangohq/[email protected]$GIT_HASH | |
| npm i | |
| # Compile the project | |
| npx nango compile --debug |