Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,36 @@ github:
- data-viz
- canvas
- svg
protected_branches:
master:
required_status_checks:
# strict means "Require branches to be up to date before merging".
strict: false
# contexts are the names of checks that must pass
# contexts:
# - gh-infra/jenkins
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: false
required_approving_review_count: 1
required_linear_history: false
required_signatures: false
release:
required_status_checks:
strict: false
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: false
required_approving_review_count: 1
required_linear_history: false
required_signatures: false
next:
required_status_checks:
strict: false
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: false
required_approving_review_count: 1
required_linear_history: false
required_signatures: false

37 changes: 37 additions & 0 deletions .github/workflows/nightly-next.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Nightly Next

on:
schedule:
- cron: '0 9 * * *' # After zrender nightly published
# committers can manually trigger with workflow_dispatch
workflow_dispatch: {}
repository_dispatch:
types: publish-nightly-next

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
with:
ref: next

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
registry-url: https://registry.npmjs.org/
- name: Setup and publish nightly
run: |
npm ci
npm run release
npm run test
npm run test:dts
node build/prepareNightly.js --next
npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
44 changes: 27 additions & 17 deletions build/prepareNightly.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,36 @@ const packageJsonPath = __dirname + '/../package.json';
const nightlyPackageName = 'echarts-nightly';

const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
const version = packageJson.version;
const parts = /(\d+)\.(\d+)\.(\d+)($|\-.*)/.exec(version);
if (!parts) {
throw new Error(`Invalid version number ${version}`);
}
// Add date to version.
const major = +parts[1];
const minor = +parts[2];
let patch = +parts[3];
const notDev = !(parts[4] && parts[4].includes('-dev'));
if (notDev) {
// It's previous stable or rc version. Dev version should be higher.
patch++;
}

const date = new Date().toISOString().replace(/:|T|\.|-/g, '').slice(0, 8);
const nightlyVersion = `${major}.${minor}.${patch}-dev.${date}`;
function updateVersion(version) {
const isNext = process.argv.includes('--next');
const parts = /(\d+)\.(\d+)\.(\d+)($|\-)/.exec(version);
if (!parts) {
throw new Error(`Invalid version number ${version}`);
}
// Add date to version.
const major = +parts[1];
let minor = +parts[2];
let patch = +parts[3];
const isStable = !parts[4];
if (isStable) {
// It's previous stable version. Dev version should be higher.
if (isNext) {
// Increase minor version for next branch.
minor++;
}
else {
// Increase main version for master branch.
patch++;
}
}

const date = new Date().toISOString().replace(/:|T|\.|-/g, '').slice(0, 8);
return `${major}.${minor}.${patch}-dev.${date}`;
}

packageJson.name = nightlyPackageName;
packageJson.version = nightlyVersion;
packageJson.version = updateVersion(packageJson.version);

fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8');

Expand Down