mirror of
https://github.com/mathuo/dockview
synced 2025-05-01 17:18:27 +00:00
chore: Github Action npm experimental publish
This commit is contained in:
parent
e3ed4251ed
commit
d4d79b220f
29
.github/workflows/experimental.yml
vendored
Normal file
29
.github/workflows/experimental.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: Publish Experimental Package to npmjs
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# release:
|
||||
# types: [published]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '16.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: yarn
|
||||
- run: npm run set-experimental-verisons
|
||||
- run: npm run build
|
||||
- run: npm run test
|
||||
- run: npm publish --tag experimental --dry-run
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
@ -18,6 +18,7 @@
|
||||
"clean": "lerna run clean",
|
||||
"bootstrap": "lerna bootstrap",
|
||||
"test:cov": "jest --coverage",
|
||||
"set-experimental-versions": "node scripts/set-experimental-versions",
|
||||
"version-beta-build": "lerna version prerelease --preid beta",
|
||||
"publish-app": "lerna publish",
|
||||
"docs": "typedoc",
|
||||
|
61
scripts/set-experimental-versions.js
Normal file
61
scripts/set-experimental-versions.js
Normal file
@ -0,0 +1,61 @@
|
||||
const cp = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const rootDir = path.join(__dirname, '..');
|
||||
|
||||
function formatDate() {
|
||||
const date = new Date();
|
||||
|
||||
function pad(value) {
|
||||
if (value.toString().length === 1) {
|
||||
return `0${value}`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
return `${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(
|
||||
date.getDate()
|
||||
)}`;
|
||||
}
|
||||
|
||||
function shortGitHash() {
|
||||
return cp
|
||||
.execSync('git rev-parse --short HEAD', {
|
||||
cwd: rootDir,
|
||||
})
|
||||
.toString()
|
||||
.replace(/\n/g, '');
|
||||
}
|
||||
|
||||
const version = `0.0.0-experimental-${shortGitHash()}-${formatDate()}`;
|
||||
|
||||
// dockview-core
|
||||
|
||||
const dockviewCorePath = path.join(
|
||||
rootDir,
|
||||
'packages',
|
||||
'dockview-core',
|
||||
'package.json'
|
||||
);
|
||||
const dockviewCorePackageJson = JSON.parse(
|
||||
fs.readFileSync(dockviewCorePath).toString()
|
||||
);
|
||||
|
||||
dockviewCorePackageJson.version = version;
|
||||
|
||||
fs.writeFileSync(
|
||||
dockviewCorePath,
|
||||
JSON.stringify(dockviewCorePackageJson, null, 4)
|
||||
);
|
||||
|
||||
// dockview
|
||||
|
||||
const dockviewPath = path.join(rootDir, 'packages', 'dockview', 'package.json');
|
||||
const dockviewPackageJson = JSON.parse(
|
||||
fs.readFileSync(dockviewPath).toString()
|
||||
);
|
||||
|
||||
dockviewPackageJson.version = version;
|
||||
dockviewPackageJson.dependencies['dockview-core'] = dockviewPackageJson.version;
|
||||
|
||||
fs.writeFileSync(dockviewPath, JSON.stringify(dockviewPackageJson, null, 4));
|
Loading…
Reference in New Issue
Block a user