73 lines
2.0 KiB
YAML
73 lines
2.0 KiB
YAML
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
# The @umbraco-cms scope is owned by Umbraco HQ
|
|
|
|
name: Node.js Libraries Package
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'libs/**'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
- '.github/workflows/npm-publish-github-packages.yml'
|
|
- './rollup-libs.config.js'
|
|
- 'src/**/*.element.ts'
|
|
pull_request:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'libs/**'
|
|
- 'package.json'
|
|
- 'package-lock.json'
|
|
- '.github/workflows/npm-publish-github-packages.yml'
|
|
- './rollup-libs.config.js'
|
|
- 'src/**/*.element.ts'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
NODE_OPTIONS: --max-old-space-size=16384
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
cache: 'npm'
|
|
- run: npm ci
|
|
- run: npm run build:libs
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: artifact
|
|
path: ./dist/libs
|
|
|
|
publish-npm:
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
concurrency:
|
|
group: npm-publish
|
|
cancel-in-progress: true
|
|
steps:
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: artifact
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
registry-url: https://registry.npmjs.org/
|
|
scope: '@umbraco-cms'
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
- name: Version and publish
|
|
run: |
|
|
SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-8)
|
|
npm whoami
|
|
npm version 1.0.0-next.$SHA_SHORT --allow-same-version --no-git-tag-version
|
|
npm publish --tag next --access public
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|