58 lines
1.9 KiB
YAML
58 lines
1.9 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: Publish Library
|
|
run: |
|
|
if [ "${{github.ref_name}}" = "master" ]; then
|
|
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
|
|
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
|
|
uses: ztimson/actions/.github/workflows/docker.yaml@develop
|
|
with:
|
|
name: ztimson/node-utils
|
|
repository: ${{github.server_url}}/${{github.repository}}.git
|
|
pass: ${{secrets.DEPLOY_TOKEN}}
|