Skip to content

Commit

Permalink
Issue #224544 feat: Enable GitHub Actions to publish NPM package
Browse files Browse the repository at this point in the history
  • Loading branch information
rajnishdargan committed Aug 9, 2024
1 parent 24e6dca commit 003ba75
Showing 1 changed file with 6 additions and 42 deletions.
48 changes: 6 additions & 42 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: List files
run: ls -la ~/

- name: Authenticate with npm
- name: Create .npmrc
run: echo "//registry.npmjs.org/:_authToken=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" > ~/.npmrc

- name: Display .npmrc contents
Expand All @@ -43,52 +43,16 @@ jobs:
- name: πŸ› οΈ Build Library
run: npm run build-lib

- name: List contents of dist/quml-library
run: ls -la dist/quml-library

- name: 🚒 Publish to NPM
run: |
cd dist/quml-library
pwd # Print the current directory
ls -la # List the contents to ensure the package is present
npm pack
echo "-----------------------------------Package is packed---------------------------------------------"
npm publish tekdi-sunbird-quml-player-* --tag=beta --access public
npm publish tekdi-sunbird-quml-player-*.tgz --tag=beta --access public
env:
NODE_AUTH_TOKEN: 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

# - name: πŸ” Ensure jq is installed
# run: sudo apt-get install -y jq

# - name: πŸ” Check if Version Exists
# id: check-version
# run: |
# cd dist/quml-library
# pwd # Print the current directory
# ls
# PACKAGE_NAME=$(jq -r .name package.json)
# echo "Package Name: $(jq -r .name package.json)"
# PACKAGE_VERSION=$(jq -r .version package.json)
# echo "Package Version: $(jq -r .version package.json)"
# NPM_REGISTRY="https://registry.npmjs.org"
# STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$NPM_REGISTRY/$PACKAGE_NAME/$PACKAGE_VERSION")
# echo "status=$STATUS" >> $GITHUB_ENV

# - name: 🚒 Publish to NPM
# if: env.status != '200'
# run: |
# echo env.status
# cd dist/quml-library
# pwd # Print the current directory
# npm pack
# echo "-----------------------------------Package is packed---------------------------------------------"
# echo "-----------------------------------Contents inside directory-------------------------------------"
# ls
# if [[ "$(jq -r .version package.json)" == *"beta"* ]]; then
# echo "---Publish the package---"
# npm publish tekdi-sunbird-quml-player-* --tag=beta
# else
# npm publish tekdi-sunbird-quml-player-* --access public
# fi
# env:
# NODE_AUTH_TOKEN: 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

# - name: πŸ“œ Log Version Exists
# if: env.status == '200'
# run: echo "Version already exists, skipping publish."

0 comments on commit 003ba75

Please sign in to comment.