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
|
|
@ -31,6 +31,7 @@ Org secrets (set on `coulomb` org): `REGISTRY_USER`, `REGISTRY_TOKEN`.
|
||||||
| `workflows/ci-smoke.yaml` | 1 | Git+CI routing drill; infra/docs repos |
|
| `workflows/ci-smoke.yaml` | 1 | Git+CI routing drill; infra/docs repos |
|
||||||
| `workflows/container-build-push.yaml` | 2 | Single-repo `Dockerfile` image publish |
|
| `workflows/container-build-push.yaml` | 2 | Single-repo `Dockerfile` image publish |
|
||||||
| `workflows/container-build-push-multirepo.yaml` | 3 prep | Docker build with named contexts (e.g. `state-hub` + `hub-core`) |
|
| `workflows/container-build-push-multirepo.yaml` | 3 prep | Docker build with named contexts (e.g. `state-hub` + `hub-core`) |
|
||||||
|
| `workflows/npm-publish.yaml` | 2+ | Publish `@coulomb/*` npm package on version tag |
|
||||||
|
|
||||||
## Adoption
|
## Adoption
|
||||||
|
|
||||||
|
|
|
||||||
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