Create and publish Angular npm package #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create and publish Angular npm package | |
on: | |
workflow_dispatch: | |
inputs: | |
angularVersion: | |
required: true | |
type: choice | |
options: | |
- '14' | |
- '15' | |
- '16' | |
- '17' | |
- '18' | |
description: The version of Angular you want to build | |
permissions: | |
contents: read | |
jobs: | |
publish_angular: | |
runs-on: ubuntu-latest | |
if: github.repository == 'trimble-oss/modus-web-components' | |
defaults: | |
run: | |
working-directory: ./angular-workspace/ng${{ github.event.inputs.angularVersion }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Setup Node.js environment for Angular versions up to 16 | |
- name: Setup Node.js environment (Angular <= 16) | |
if: ${{ github.event.inputs.angularVersion < 17 }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
# Setup Node.js environment specifically for Angular version 17 and above | |
- name: Setup Node.js environment (Angular >= 17) | |
if: ${{ github.event.inputs.angularVersion >= 17 }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Modus Web Components | |
run: npm ci | |
working-directory: ./stencil-workspace | |
- name: Build Modus Web Components | |
run: npm run build | |
working-directory: ./stencil-workspace | |
- name: npm install | |
run: npm i | |
working-directory: ./angular-workspace/ng${{ github.event.inputs.angularVersion }}/projects/trimble-oss/modus-angular-components | |
- name: Install Angular ${{ github.event.inputs.angularVersion }} | |
run: npm ci | |
- name: Build Angular ${{ github.event.inputs.angularVersion }} | |
run: npm run build | |
- name: Set npm Registry Auth Token | |
run: npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TRIMBLE_OSS_AUTOMATION_TOKEN }} | |
- name: Publish Angular npm Package Publicly | |
run: npm publish --access public | |
working-directory: ./angular-workspace/ng${{ github.event.inputs.angularVersion }}/dist/trimble-oss/modus-angular-components | |
- name: Set GitHub Registry Auth Token | |
run: npm set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Angular npm Package to GitHub Registry | |
run: npm publish --access public --ignore-scripts --@trimble-oss:registry='https://npm.pkg.github.com' | |
working-directory: ./angular-workspace/ng${{ github.event.inputs.angularVersion }}/dist/trimble-oss/modus-angular-components |