mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make a master tag of the extensions API (#2888)
* Make a master tag of the extensions API Signed-off-by: Sebastian Malton <sebastian@malton.name> * use the gitref as a prerelease header Signed-off-by: Sebastian Malton <sebastian@malton.name> * Reduce the number of releases Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix if Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
0fb927f96b
commit
278510a90a
38
.github/workflows/publish-master-npm.yml
vendored
Normal file
38
.github/workflows/publish-master-npm.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: Publish NPM Package `master`
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
types:
|
||||
- closed
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish NPM Package `master`
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'area/extension') }}
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: Checkout Release
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Using Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Generate NPM package
|
||||
run: |
|
||||
make build-npm
|
||||
|
||||
- name: publish new release
|
||||
if: contains(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
make publish-npm
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_RELEASE_TAG: master
|
||||
@ -1,11 +1,11 @@
|
||||
name: Publish NPM
|
||||
name: Publish NPM Package Release
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish NPM
|
||||
name: Publish NPM Package Release
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
3
Makefile
3
Makefile
@ -110,7 +110,8 @@ build-extension-types: node_modules src/extensions/npm/extensions/dist
|
||||
.PHONY: publish-npm
|
||||
publish-npm: node_modules build-npm
|
||||
./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
||||
cd src/extensions/npm/extensions && npm publish --access=public
|
||||
cd src/extensions/npm/extensions && npm publish --access=public --tag=${NPM_RELEASE_TAG:-latest}
|
||||
git restore src/extensions/npm/extensions/package.json
|
||||
|
||||
.PHONY: docs
|
||||
docs:
|
||||
|
||||
@ -22,8 +22,20 @@ import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import packageInfo from "../src/extensions/npm/extensions/package.json";
|
||||
import appInfo from "../package.json";
|
||||
import { SemVer } from "semver";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
const packagePath = path.join(__dirname, "../src/extensions/npm/extensions/package.json");
|
||||
const { NPM_RELEASE_TAG = "latest" } = process.env;
|
||||
const version = new SemVer(appInfo.version);
|
||||
|
||||
packageInfo.version = appInfo.version;
|
||||
fs.writeFileSync(packagePath, `${JSON.stringify(packageInfo, null, 2)}\n`);
|
||||
if (NPM_RELEASE_TAG !== "latest") {
|
||||
const gitRef = execSync("git rev-parse --short HEAD", {
|
||||
encoding: "utf-8",
|
||||
});
|
||||
|
||||
version.inc("prerelease", `git.${gitRef.trim()}`);
|
||||
}
|
||||
|
||||
packageInfo.version = version.format();
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, "../src/extensions/npm/extensions/package.json"), `${JSON.stringify(packageInfo, null, 2)}\n`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user