This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
Publish all publishable libraries #32
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: Publish all publishable libraries | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
type: choice | |
description: Release type | |
options: | |
- patch | |
- minor | |
env: | |
NX_CACHE_DIRECTORY: '.nx-cache' | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "publish" | |
cancel-in-progress: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 18.x ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: "https://registry.npmjs.org" | |
- name: Restore cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.angular/cache | |
.nx-cache | |
key: ${{ runner.os }}-angular-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx', '**.html', '**.scss') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-angular-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- | |
- name: Install dependencies | |
run: npm ci | |
- name: setup git config | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Update version | |
run: | | |
npx nx run workspace:version --release=${{inputs.release}} | |
- name: Publish to NPMJS.com | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
npx nx run-many --target=publish --tag=latest | |
- name: Push tags | |
run: | | |
git push origin main --tags |