mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
move extension npm package files & add release automation
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
a8cab69423
commit
29c09feaf8
15
.github/workflows/publish-master-npm.yml
vendored
15
.github/workflows/publish-master-npm.yml
vendored
@ -1,17 +1,16 @@
|
||||
name: Publish NPM Package `master`
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
concurrency:
|
||||
group: publish-master-npm
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish NPM Package `master`
|
||||
name: Publish Extensions NPM Package `master`
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'area/extension') }}
|
||||
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'area/extension') }}
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
@ -28,11 +27,11 @@ jobs:
|
||||
|
||||
- name: Generate NPM package
|
||||
run: |
|
||||
make build-npm
|
||||
make build-extensions-npm
|
||||
|
||||
- name: publish new release
|
||||
run: |
|
||||
make publish-npm
|
||||
make publish-extensions-npm
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_RELEASE_TAG: master
|
||||
|
||||
37
.github/workflows/publish-release-npm.yml
vendored
37
.github/workflows/publish-release-npm.yml
vendored
@ -12,8 +12,8 @@ on:
|
||||
type: string
|
||||
description: The version to release manually
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish NPM Package Release
|
||||
publish-extensions:
|
||||
name: Publish Extensions NPM Package Release
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
@ -32,10 +32,37 @@ jobs:
|
||||
|
||||
- name: Generate NPM package
|
||||
run: |
|
||||
make build-npm
|
||||
make build-extensions-npm
|
||||
|
||||
- name: publish new release
|
||||
- name: Publish NPM package
|
||||
run: |
|
||||
make publish-npm
|
||||
make publish-extensions-npm
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
publish-library:
|
||||
name: Publish Library NPM Package Release
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
steps:
|
||||
- name: Checkout Release
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ inputs.version }}
|
||||
|
||||
- name: Using Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Generate NPM package
|
||||
run: |
|
||||
make build-library-npm
|
||||
|
||||
- name: Publish NPM package
|
||||
run: |
|
||||
make publish-library-npm
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -10,10 +10,6 @@ static/build
|
||||
static/types
|
||||
binaries/client/
|
||||
binaries/server/
|
||||
src/extensions/*/*.js
|
||||
src/extensions/*/*.d.ts
|
||||
types/extension-api.d.ts
|
||||
types/extension-renderer-api.d.ts
|
||||
extensions/*/dist
|
||||
docs/extensions/api
|
||||
site/
|
||||
|
||||
39
Makefile
39
Makefile
@ -67,7 +67,7 @@ endif
|
||||
$(extension_node_modules): node_modules
|
||||
cd $(@:/node_modules=) && ../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
||||
|
||||
$(extension_dists): src/extensions/npm/extensions/dist $(extension_node_modules)
|
||||
$(extension_dists): packages/extensions/dist $(extension_node_modules)
|
||||
cd $(@:/dist=) && ../../node_modules/.bin/npm run build
|
||||
rm -rf ./node_modules/$(shell basename $(@:/dist=))
|
||||
|
||||
@ -83,27 +83,35 @@ build-extensions: node_modules clean-old-extensions $(extension_dists)
|
||||
test-extensions: $(extension_node_modules)
|
||||
$(foreach dir, $(extensions), (cd $(dir) && npm run test || exit $?);)
|
||||
|
||||
src/extensions/npm/extensions/__mocks__:
|
||||
cp -r __mocks__ src/extensions/npm/extensions/
|
||||
packages/extensions/__mocks__:
|
||||
cp -r __mocks__ packages/extensions/
|
||||
|
||||
src/extensions/npm/extensions/dist: src/extensions/npm/extensions/node_modules
|
||||
packages/extensions/dist: packages/extensions/node_modules
|
||||
yarn compile:extension-types
|
||||
|
||||
src/extensions/npm/extensions/node_modules: src/extensions/npm/extensions/package.json
|
||||
cd src/extensions/npm/extensions/ && ../../../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
||||
packages/extensions/node_modules: packages/extensions/package.json
|
||||
cd packages/extensions/ && ../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
||||
|
||||
.PHONY: build-npm
|
||||
build-npm: build-extension-types src/extensions/npm/extensions/__mocks__
|
||||
yarn npm:fix-package-version
|
||||
.PHONY: build-extensions-npm
|
||||
build-extensions-npm: build-extension-types packages/extensions/__mocks__
|
||||
yarn npm:fix-extensions-package-version
|
||||
|
||||
.PHONY: build-library-npm
|
||||
build-library-npm:
|
||||
yarn compile-library
|
||||
|
||||
.PHONY: build-extension-types
|
||||
build-extension-types: node_modules src/extensions/npm/extensions/dist
|
||||
build-extension-types: node_modules packages/extensions/dist
|
||||
|
||||
.PHONY: publish-npm
|
||||
publish-npm: node_modules build-npm
|
||||
.PHONY: publish-extensions-npm
|
||||
publish-extensions-npm: node_modules build-extensions-npm
|
||||
./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
||||
cd src/extensions/npm/extensions && npm publish --access=public --tag=$(NPM_RELEASE_TAG)
|
||||
git restore src/extensions/npm/extensions/package.json
|
||||
cd packages/extensions && npm publish --access=public --tag=$(NPM_RELEASE_TAG) && git restore package.json
|
||||
|
||||
.PHONY: publish-library-npm
|
||||
publish-library-npm: node_modules build-library-npm
|
||||
./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
||||
npm init -y --scope @k8slens && npm publish --access=public --tag=$(NPM_RELEASE_TAG) && git restore package.json
|
||||
|
||||
.PHONY: build-docs
|
||||
build-docs:
|
||||
@ -119,7 +127,8 @@ clean-extensions:
|
||||
|
||||
.PHONY: clean-npm
|
||||
clean-npm:
|
||||
rm -rf src/extensions/npm/extensions/{dist,__mocks__,node_modules}
|
||||
rm -rf packages/extensions/{dist,__mocks__,node_modules}
|
||||
rm -rf static/build/library/
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-npm clean-extensions
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import packageInfo from "../src/extensions/npm/extensions/package.json";
|
||||
import packageInfo from "../packages/extensions/package.json";
|
||||
import appInfo from "../package.json";
|
||||
import { SemVer } from "semver";
|
||||
import { execSync } from "child_process";
|
||||
@ -22,4 +22,4 @@ if (NPM_RELEASE_TAG !== "latest") {
|
||||
|
||||
packageInfo.version = version.format();
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, "../src/extensions/npm/extensions/package.json"), `${JSON.stringify(packageInfo, null, 2)}\n`);
|
||||
fs.writeFileSync(path.join(__dirname, "../packages/extensions/package.json"), `${JSON.stringify(packageInfo, null, 2)}\n`);
|
||||
22
package.json
22
package.json
@ -4,6 +4,17 @@
|
||||
"description": "OpenLens - Open Source IDE for Kubernetes",
|
||||
"homepage": "https://github.com/lensapp/lens",
|
||||
"version": "6.3.0-alpha.0",
|
||||
"directories": {
|
||||
"doc": "docs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lensapp/lens.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"bugs": {
|
||||
"url": "https://github.com/lensapp/lens/issues"
|
||||
},
|
||||
"main": "static/build/main.js",
|
||||
"exports": {
|
||||
"./main": "./static/build/library/main.js",
|
||||
@ -25,19 +36,16 @@
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"build/**/*",
|
||||
"build/download_binaries.ts",
|
||||
"src/**/*",
|
||||
"!src/extensions/npm/**/*",
|
||||
"static/build/library/**/*",
|
||||
"templates/**/*",
|
||||
"types/*",
|
||||
"tsconfig.json"
|
||||
],
|
||||
"copyright": "© 2022 OpenLens Authors",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "OpenLens Authors",
|
||||
"email": "info@k8slens.dev"
|
||||
},
|
||||
"author": "OpenLens Authors <info@k8slens.dev>",
|
||||
"scripts": {
|
||||
"adr:create": "echo \"What is the title?\"; read title; adr new \"$title\"",
|
||||
"adr:change-status": "echo \"Decision number?:\"; read decision; adr status $decision",
|
||||
@ -56,7 +64,7 @@
|
||||
"compile:extension-types": "yarn run webpack --config webpack/extensions.ts",
|
||||
"compile:node-fetch": "yarn run webpack --config ./webpack/node-fetch.ts",
|
||||
"prepare": "yarn run compile:node-fetch",
|
||||
"npm:fix-package-version": "yarn run ts-node build/set_npm_version.ts",
|
||||
"npm:fix-extensions-package-version": "yarn run ts-node build/set_extensions_npm_version.ts",
|
||||
"build:linux": "yarn run compile && electron-builder --linux --dir",
|
||||
"build:mac": "yarn run compile && electron-builder --mac --dir",
|
||||
"build:win": "yarn run compile && electron-builder --win --dir",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "@k8slens/extensions",
|
||||
"productName": "OpenLens extensions",
|
||||
"description": "OpenLens - Open Source Kubernetes IDE: extensions",
|
||||
"version": "6.0.0",
|
||||
"version": "6.3.0-alpha.0",
|
||||
"copyright": "© 2022 OpenLens Authors",
|
||||
"license": "MIT",
|
||||
"main": "dist/src/extensions/extension-api.js",
|
||||
Loading…
Reference in New Issue
Block a user