forked from NangoHQ/nango
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nan-668] add verification bash script to publish packages (NangoHQ#1930
) ## Describe your changes The goal with this PR is to mimic a publish process of the cli with the code that is in review to ensure a working cli that is in a remote source. This is accomplished by building and publishing the packages to the Github registry and finally using the cli to verify that it works expected. This will protect against instances where a faulty cli is published. This will be especially useful to verify that this PR: NangoHQ#1918 works as expected with packaging the utils package. Additionally, as we refactor the cli to move code out of shared and reduce the package size of the cli this will ensure things still work as expected. ## Issue ticket number and link NAN-668 ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [ ] I added tests, otherwise the reason is: - [ ] I added observability, otherwise the reason is: - [ ] I added analytics, otherwise the reason is:
- Loading branch information
1 parent
810151a
commit d3c521a
Showing
2 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: CLI Publish & Verify | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- staging/** | ||
pull_request: | ||
|
||
concurrency: | ||
group: verify-cli-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish-and-test: | ||
runs-on: ubuntu-latest | ||
env: | ||
NANGO_CLI_UPGRADE_MODE: ignore | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@nangohq' | ||
always-auth: true | ||
- name: Publish npm packages to the github registry | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
shell: bash | ||
continue-on-error: true | ||
run: | | ||
GIT_HASH=$(git rev-parse HEAD) | ||
bash ./scripts/publish.sh 0.0.1-$GIT_HASH | ||
- name: Publish the cli privately under the correct scope | ||
working-directory: packages/cli | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
jq '.name = "@nangohq/cli"' package.json > temp.json && mv temp.json package.json | ||
npm publish --access public | ||
- name: Install the cli from the github package registry | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
GIT_HASH=$(git rev-parse HEAD) | ||
mkdir nango-cli-test && cd nango-cli-test | ||
npm init -y | ||
npm install @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; } | ||
npx nango version --debug | ||
npx nango init --debug | ||
cd nango-integrations | ||
npx nango generate --debug |
This file contains 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