# Publish npm package to Forgejo org registry (@coulomb scope). # Copy to REPO/.forgejo/workflows/npm-publish.yaml and set secrets: # FORGEJO_NPM_TOKEN — PAT with write:package (org coulomb) name: npm-publish on: push: tags: - 'v*' jobs: publish: runs-on: docker steps: - name: Checkout run: | git clone --depth 1 "${{ github.server_url }}/${{ github.repository }}.git" . git checkout "${{ github.sha }}" - name: Setup Node run: | command -v npm >/dev/null 2>&1 || { echo "npm not on runner image" >&2; exit 1; } npm --version - name: Install and test run: | if [ -f package-lock.json ]; then npm ci; else npm install; fi npm test --if-present - name: Publish to Forgejo npm env: FORGEJO_NPM_TOKEN: ${{ secrets.FORGEJO_NPM_TOKEN }} run: | REGISTRY="${{ github.server_url }}/api/packages/coulomb/npm/" npm config set @coulomb:registry "${REGISTRY}" HOST="${REGISTRY#https:}" npm config set -- "${HOST}:_authToken" "${FORGEJO_NPM_TOKEN}" npm publish --scope=@coulomb --access public