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`
|
name: Publish NPM Package `master`
|
||||||
on:
|
on:
|
||||||
push:
|
pull_request:
|
||||||
branches:
|
types:
|
||||||
- master
|
- closed
|
||||||
concurrency:
|
concurrency:
|
||||||
group: publish-master-npm
|
group: publish-master-npm
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
name: Publish NPM Package `master`
|
name: Publish Extensions NPM Package `master`
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: |
|
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'area/extension') }}
|
||||||
${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'area/extension') }}
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x]
|
node-version: [16.x]
|
||||||
@ -28,11 +27,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate NPM package
|
- name: Generate NPM package
|
||||||
run: |
|
run: |
|
||||||
make build-npm
|
make build-extensions-npm
|
||||||
|
|
||||||
- name: publish new release
|
- name: publish new release
|
||||||
run: |
|
run: |
|
||||||
make publish-npm
|
make publish-extensions-npm
|
||||||
env:
|
env:
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
NPM_RELEASE_TAG: master
|
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
|
type: string
|
||||||
description: The version to release manually
|
description: The version to release manually
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish-extensions:
|
||||||
name: Publish NPM Package Release
|
name: Publish Extensions NPM Package Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@ -32,10 +32,37 @@ jobs:
|
|||||||
|
|
||||||
- name: Generate NPM package
|
- name: Generate NPM package
|
||||||
run: |
|
run: |
|
||||||
make build-npm
|
make build-extensions-npm
|
||||||
|
|
||||||
- name: publish new release
|
- name: Publish NPM package
|
||||||
run: |
|
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:
|
env:
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@ -10,10 +10,6 @@ static/build
|
|||||||
static/types
|
static/types
|
||||||
binaries/client/
|
binaries/client/
|
||||||
binaries/server/
|
binaries/server/
|
||||||
src/extensions/*/*.js
|
|
||||||
src/extensions/*/*.d.ts
|
|
||||||
types/extension-api.d.ts
|
|
||||||
types/extension-renderer-api.d.ts
|
|
||||||
extensions/*/dist
|
extensions/*/dist
|
||||||
docs/extensions/api
|
docs/extensions/api
|
||||||
site/
|
site/
|
||||||
|
|||||||
39
Makefile
39
Makefile
@ -67,7 +67,7 @@ endif
|
|||||||
$(extension_node_modules): node_modules
|
$(extension_node_modules): node_modules
|
||||||
cd $(@:/node_modules=) && ../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
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
|
cd $(@:/dist=) && ../../node_modules/.bin/npm run build
|
||||||
rm -rf ./node_modules/$(shell basename $(@:/dist=))
|
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)
|
test-extensions: $(extension_node_modules)
|
||||||
$(foreach dir, $(extensions), (cd $(dir) && npm run test || exit $?);)
|
$(foreach dir, $(extensions), (cd $(dir) && npm run test || exit $?);)
|
||||||
|
|
||||||
src/extensions/npm/extensions/__mocks__:
|
packages/extensions/__mocks__:
|
||||||
cp -r __mocks__ src/extensions/npm/extensions/
|
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
|
yarn compile:extension-types
|
||||||
|
|
||||||
src/extensions/npm/extensions/node_modules: src/extensions/npm/extensions/package.json
|
packages/extensions/node_modules: packages/extensions/package.json
|
||||||
cd src/extensions/npm/extensions/ && ../../../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
cd packages/extensions/ && ../../node_modules/.bin/npm install --no-audit --no-fund --no-save
|
||||||
|
|
||||||
.PHONY: build-npm
|
.PHONY: build-extensions-npm
|
||||||
build-npm: build-extension-types src/extensions/npm/extensions/__mocks__
|
build-extensions-npm: build-extension-types packages/extensions/__mocks__
|
||||||
yarn npm:fix-package-version
|
yarn npm:fix-extensions-package-version
|
||||||
|
|
||||||
|
.PHONY: build-library-npm
|
||||||
|
build-library-npm:
|
||||||
|
yarn compile-library
|
||||||
|
|
||||||
.PHONY: build-extension-types
|
.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
|
.PHONY: publish-extensions-npm
|
||||||
publish-npm: node_modules build-npm
|
publish-extensions-npm: node_modules build-extensions-npm
|
||||||
./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
./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)
|
cd packages/extensions && npm publish --access=public --tag=$(NPM_RELEASE_TAG) && git restore package.json
|
||||||
git restore src/extensions/npm/extensions/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
|
.PHONY: build-docs
|
||||||
build-docs:
|
build-docs:
|
||||||
@ -119,7 +127,8 @@ clean-extensions:
|
|||||||
|
|
||||||
.PHONY: clean-npm
|
.PHONY: clean-npm
|
||||||
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
|
.PHONY: clean
|
||||||
clean: clean-npm clean-extensions
|
clean: clean-npm clean-extensions
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
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 appInfo from "../package.json";
|
||||||
import { SemVer } from "semver";
|
import { SemVer } from "semver";
|
||||||
import { execSync } from "child_process";
|
import { execSync } from "child_process";
|
||||||
@ -22,4 +22,4 @@ if (NPM_RELEASE_TAG !== "latest") {
|
|||||||
|
|
||||||
packageInfo.version = version.format();
|
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",
|
"description": "OpenLens - Open Source IDE for Kubernetes",
|
||||||
"homepage": "https://github.com/lensapp/lens",
|
"homepage": "https://github.com/lensapp/lens",
|
||||||
"version": "6.3.0-alpha.0",
|
"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",
|
"main": "static/build/main.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
"./main": "./static/build/library/main.js",
|
"./main": "./static/build/library/main.js",
|
||||||
@ -25,19 +36,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"build/**/*",
|
"build/download_binaries.ts",
|
||||||
"src/**/*",
|
"src/**/*",
|
||||||
"!src/extensions/npm/**/*",
|
|
||||||
"static/build/library/**/*",
|
"static/build/library/**/*",
|
||||||
|
"templates/**/*",
|
||||||
"types/*",
|
"types/*",
|
||||||
"tsconfig.json"
|
"tsconfig.json"
|
||||||
],
|
],
|
||||||
"copyright": "© 2022 OpenLens Authors",
|
"copyright": "© 2022 OpenLens Authors",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
"author": "OpenLens Authors <info@k8slens.dev>",
|
||||||
"name": "OpenLens Authors",
|
|
||||||
"email": "info@k8slens.dev"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"adr:create": "echo \"What is the title?\"; read title; adr new \"$title\"",
|
"adr:create": "echo \"What is the title?\"; read title; adr new \"$title\"",
|
||||||
"adr:change-status": "echo \"Decision number?:\"; read decision; adr status $decision",
|
"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:extension-types": "yarn run webpack --config webpack/extensions.ts",
|
||||||
"compile:node-fetch": "yarn run webpack --config ./webpack/node-fetch.ts",
|
"compile:node-fetch": "yarn run webpack --config ./webpack/node-fetch.ts",
|
||||||
"prepare": "yarn run compile:node-fetch",
|
"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:linux": "yarn run compile && electron-builder --linux --dir",
|
||||||
"build:mac": "yarn run compile && electron-builder --mac --dir",
|
"build:mac": "yarn run compile && electron-builder --mac --dir",
|
||||||
"build:win": "yarn run compile && electron-builder --win --dir",
|
"build:win": "yarn run compile && electron-builder --win --dir",
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "@k8slens/extensions",
|
"name": "@k8slens/extensions",
|
||||||
"productName": "OpenLens extensions",
|
"productName": "OpenLens extensions",
|
||||||
"description": "OpenLens - Open Source Kubernetes IDE: extensions",
|
"description": "OpenLens - Open Source Kubernetes IDE: extensions",
|
||||||
"version": "6.0.0",
|
"version": "6.3.0-alpha.0",
|
||||||
"copyright": "© 2022 OpenLens Authors",
|
"copyright": "© 2022 OpenLens Authors",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/src/extensions/extension-api.js",
|
"main": "dist/src/extensions/extension-api.js",
|
||||||
Loading…
Reference in New Issue
Block a user