This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/echarts-website.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 19568cbc8 chore: remove purge-cdn workflow & update action deps
19568cbc8 is described below
commit 19568cbc8de4570ccc9bdbff6ee32096d001b211
Author: Zhongxiang Wang <[email protected]>
AuthorDate: Sat Feb 3 09:03:09 2024 +0800
chore: remove purge-cdn workflow & update action deps
---
.github/workflows/check-links.yml | 14 +++++-----
.github/workflows/deploy.yml | 10 +++----
.github/workflows/purge-cdn.yml | 32 -----------------------
.scripts/package.json | 3 +--
.scripts/purgeCDN.js | 55 ---------------------------------------
5 files changed, 12 insertions(+), 102 deletions(-)
diff --git a/.github/workflows/check-links.yml
b/.github/workflows/check-links.yml
index bb3351766..71a8ca408 100644
--- a/.github/workflows/check-links.yml
+++ b/.github/workflows/check-links.yml
@@ -10,17 +10,15 @@ jobs:
build:
runs-on: ubuntu-latest
- strategy:
- matrix:
- node-version: [12.x]
-
steps:
- - uses: actions/checkout@v2
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v2
+ - uses: actions/checkout@v4
+
+ - uses: actions/setup-node@v4
with:
+ node-version: 18
registry-url: https://registry.npmjs.org/
- - name: Check links
+
+ - name: Check Links
run: |
npm i
node checkLinks.js
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 5ac5447eb..7b3712272 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -8,12 +8,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup Node.js
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
- node-version: 16
+ node-version: 18
+ registry-url: https://registry.npmjs.org/
- name: Prepare workspace
run: mkdir tmp-workspace
@@ -49,11 +50,10 @@ jobs:
- name: Install ECharts Handbook
working-directory: tmp-workspace
run: |
- git clone https://github.com/apache/echarts-handbook
+ git clone --depth 1 https://github.com/apache/echarts-handbook
cd echarts-handbook
npm install
-
- name: Build 🔧
working-directory: tmp-workspace
run: |
diff --git a/.github/workflows/purge-cdn.yml b/.github/workflows/purge-cdn.yml
deleted file mode 100644
index a39a08133..000000000
--- a/.github/workflows/purge-cdn.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: Check Changed Files & Purge CDN
-
-on:
- push:
- branches: [ asf-site ]
-
- workflow_dispatch:
-
-jobs:
- 'Check-Changed-Files-Purge-CDN':
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 2
-
- - name: Get changed files
- id: changed-files
- uses: tj-actions/[email protected]
- with:
- separator: ","
- files: |
- ^[^\.]
-
- - name: Purge changed files
- run: |
- npm i
- node purgeCDN.js --files ${{
steps.changed-files.outputs.all_modified_files }}
- working-directory: .scripts
-
-
diff --git a/.scripts/package.json b/.scripts/package.json
index 818aa3a90..befa8b987 100644
--- a/.scripts/package.json
+++ b/.scripts/package.json
@@ -5,7 +5,6 @@
"globby": "^11.0.3"
},
"devDependencies": {
- "node-fetch": "^2.6.1",
- "minimist": "^1.2.5"
+ "node-fetch": "^2.6.1"
}
}
diff --git a/.scripts/purgeCDN.js b/.scripts/purgeCDN.js
deleted file mode 100644
index ab6a5abf9..000000000
--- a/.scripts/purgeCDN.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// TODO no permission to run non-verified action
-
-const {runTasks} = require('./task');
-const fetch = require('node-fetch').default;
-const argv = require('minimist')(process.argv.slice(2));
-
-const files = typeof argv.files === 'string' && argv.files.split(',');
-
-if (!files || !files.length) {
- return console.log('No files to be purged');
-}
-
-function getCdnUrl(fileUrl) {
- return
`https://cdn.jsdelivr.net/gh/apache/echarts-website@asf-site/${fileUrl}`;
-}
-
-function getPurgeUrl(fileUrl) {
- return
`https://purge.jsdelivr.net/gh/apache/echarts-website@asf-site/${fileUrl}`;
-}
-
-function purge(url) {
- return fetch(encodeURI(url))
- .then(res => res.json())
- .then(res => {
- if (res.status === 'finished') {
- console.log('Purged', url);
- }
- else {
- console.error('failed to purge', url, res);
- }
- });
-}
-
-async function run() {
- console.log(`Purging ${files.length} changed files...`);
-
- const totalLen = files.length;
- let finished = 0;
- let purged = 0;
- await runTasks(files, async(filePath) => {
- try {
- await purge(getPurgeUrl(filePath));
- purged++;
- }
- catch (e) {
- console.error('failed to purge', filePath);
- console.error(e);
- }
- finished++;
- console.log(`${finished} / ${totalLen} (${(finished / totalLen *
100).toFixed(0)}%)`)
- }, 10);
- console.log(`Purged ${purged} successfully`);
-}
-
-run();
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]