feat(ci): publish monorepo libs to npm (#2951)

This commit is contained in:
Ciaran McGhie 2023-02-22 12:11:35 +00:00 committed by GitHub
parent 0a5fb9d917
commit abf69786ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 58 additions and 7 deletions

View File

@ -19,7 +19,7 @@ jobs:
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.14.0
node-version: 16.15.1
- name: Install root dependencies
run: yarn install
- name: Generate queries

View File

@ -16,7 +16,7 @@ jobs:
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.14.0
node-version: 16.15.1
- name: Install root dependencies
run: yarn install
- name: Check PR title

View File

@ -19,7 +19,7 @@ jobs:
id: Node
uses: actions/setup-node@v2
with:
node-version: 16.14.0
node-version: 16.15.1
- name: Install root dependencies
run: yarn install
- name: Generate queries

47
.github/workflows/publish-npm.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Publish libs to npm
on:
workflow_dispatch:
inputs:
project:
description: 'Monorepo project to publish'
required: true
type: choice
options:
- ui-toolkit
- react-helpers
- tailwindcss-config
- types
jobs:
publish:
name: Build & Publish - Tag
runs-on: ubuntu-latest
permissions:
contents: 'read'
actions: 'read'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: User Node.js 16
id: Node
uses: actions/setup-node@v3
with:
node-version: 16.15.1
- name: Restore node_modules from cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Install root dependencies
run: yarn install --frozen-lockfile
- name: Build project
run: yarn nx build ${{inputs.project}}
- name: Publish project to @vegaprotocol
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: dist/libs/${{inputs.project}}/package.json
access: public

View File

@ -26,7 +26,7 @@ jobs:
id: Node
uses: actions/setup-node@v3
with:
node-version: 16.14.0
node-version: 16.15.1
- name: Restore node_modules from cache
uses: actions/cache@v3
with:

2
.nvmrc
View File

@ -1 +1 @@
16.14.0
16.15.1

View File

@ -8,6 +8,7 @@
"executor": "@nrwl/web:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"buildableProjectDepsInPackageJsonType": "dependencies",
"outputPath": "dist/libs/react-helpers",
"tsConfig": "libs/react-helpers/tsconfig.lib.json",
"project": "libs/react-helpers/package.json",

View File

@ -10,7 +10,8 @@
"outputPath": "dist/libs/tailwindcss-config",
"main": "libs/tailwindcss-config/src/index.js",
"tsConfig": "libs/tailwindcss-config/tsconfig.lib.json",
"assets": ["libs/tailwindcss-config/*.md"]
"assets": ["libs/tailwindcss-config/*.md"],
"buildableProjectDepsInPackageJsonType": "dependencies"
}
},
"lint": {

View File

@ -21,7 +21,8 @@
"input": ".",
"output": "."
}
]
],
"buildableProjectDepsInPackageJsonType": "dependencies"
}
},
"lint": {

View File

@ -8,6 +8,7 @@
"executor": "@nrwl/web:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"buildableProjectDepsInPackageJsonType": "dependencies",
"outputPath": "dist/libs/ui-toolkit",
"tsConfig": "libs/ui-toolkit/tsconfig.lib.json",
"project": "libs/ui-toolkit/package.json",