Skip to content

Issue #224544 feat: Enable GitHub Actions to publish NPM package #65

Issue #224544 feat: Enable GitHub Actions to publish NPM package

Issue #224544 feat: Enable GitHub Actions to publish NPM package #65

Workflow file for this run

name: πŸš€ Publish NPM Package
pull_request:
branches:
- '**'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
actions: write
packages: write
pull-requests: write
steps:
- name: πŸ“₯ Checkout Code Repository
uses: actions/checkout@v4
- name: πŸ”§ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18.20.2'
- name: πŸ“¦ Install Dependencies
run: npm ci

Check failure on line 28 in .github/workflows/publish-package.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish-package.yml

Invalid workflow file

You have an error in your yaml syntax on line 28
- name: πŸ› οΈ Build Library
run: npm run build-lib
# - 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
# PACKAGE_NAME=$(jq -r .name package.json)
# 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: |
# cd dist/quml-library
# if [[ "$(jq -r .version package.json)" == *"beta"* ]]; then
# npm publish --tag=beta --access public
# else
# npm publish --access public
# fi
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 🚒 Publish to NPM
run: |
cd dist/quml-library
npm publish --tag=beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - name: πŸ“œ Log Version Exists
# if: env.status == '200'
# run: echo "Version already exists, skipping publish."