Files
node-utils/.github/workflows/build.yaml
ztimson f0aa4b92c6
Some checks failed
Publish Library / Build NPM Project (push) Has started running
Publish Library / Tag Version (push) Has been cancelled
Publish Library / Publish CDN & Docs (push) Has been cancelled
updated publish steps
2025-08-10 12:48:24 -04:00

70 lines
2.2 KiB
YAML

name: Publish Library
run-name: Publish Library
on:
push:
jobs:
build:
name: Build NPM Project
runs-on: ubuntu-latest
container: node:alpine
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Install & Build
run: npm i && npm run build
- name: Upload to Registry
uses: ztimson/actions/npm/publish@develop
- name: Upload to NPM
uses: ztimson/actions/npm/publish@develop
with:
owner: ztimson
registry: https://registry.npmjs.org/
token: ${{secrets.NPM_TOKEN}}
tag:
name: Tag Version
needs: build
if: ${{github.ref_name}} == 'release'
runs-on: ubuntu-latest
container: node:alpine
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Get Version Number
run: echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
- name: Tag Version
uses: ztimson/actions/tag@develop
with:
tag: ${{env.VERSION}}
docs:
name: Publish CDN & Docs
needs: build
runs-on: ubuntu-latest
container:
image: node:22
volumes:
- /tmp/gitea:/tmp/gitea
steps:
- name: Publish Library
run: |
if [ "${{github.ref_name}}" = "master" ]; then
cd lib
REGISTRY="${{github.server_url}}/api/packages/${{github.repository_owner}}/npm/"
npm set registry "$REGISTRY"
npm set $(echo $REGISTRY | sed s%http:%% | sed s%https:%% ):_authToken "${{secrets.DEPLOY_TOKEN}}"
npm publish || echo "Failed to publish"
REGISTRY="https://registry.npmjs.org/"
npm set registry "$REGISTRY"
npm set $(echo $REGISTRY | sed s%http:%% | sed s%https:%% ):_authToken "${{secrets.NPM_TOKEN}}"
npm publish || echo "Failed to publish"
fi