This is an automated email from the ASF dual-hosted git repository. shenyi pushed a commit to branch publish-nightly-next in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 6b488a8d29055f184960e3b29410bf5e23d8e33e Author: pissang <bm2736...@gmail.com> AuthorDate: Thu Sep 2 09:50:16 2021 +0800 chore: add nightly publish for next branch --- .asf.yaml | 33 ++++++++++++++++++++++++++++ .github/workflows/nightly-next.yml | 37 ++++++++++++++++++++++++++++++++ build/prepareNightly.js | 44 +++++++++++++++++++++++--------------- 3 files changed, 97 insertions(+), 17 deletions(-) diff --git a/.asf.yaml b/.asf.yaml index c35ff79..63abb9c 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -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 + diff --git a/.github/workflows/nightly-next.yml b/.github/workflows/nightly-next.yml new file mode 100644 index 0000000..7028c1d --- /dev/null +++ b/.github/workflows/nightly-next.yml @@ -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}} diff --git a/build/prepareNightly.js b/build/prepareNightly.js index 442d3d5..44d20cc 100644 --- a/build/prepareNightly.js +++ b/build/prepareNightly.js @@ -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'); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org