Add npm-publish Forgejo Actions workflow template
Supports @coulomb scoped npm packages on tag push for RAIL-HO-WP-0005 T07.
This commit is contained in:
parent
4b7c79dbad
commit
3eda3235d4
2 changed files with 34 additions and 0 deletions
33
workflows/npm-publish.yaml
Normal file
33
workflows/npm-publish.yaml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue