Skip to content

Commit

Permalink
chore(ci): fix deploy ci for 2.5
Browse files Browse the repository at this point in the history
Signed-off-by: Swilder-M <[email protected]>
  • Loading branch information
Swilder-M committed Sep 2, 2024
1 parent 8a25058 commit d770b79
Show file tree
Hide file tree
Showing 87 changed files with 222 additions and 200 deletions.
13 changes: 10 additions & 3 deletions .github/scripts/directory_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import json
import re
from urllib.parse import urlparse

directory_file = sys.argv[1]
docs_path = sys.argv[2]
Expand All @@ -17,13 +18,21 @@ def check_md_content(md_file):
return

md_content = re.sub(r'<!--([\s\S]*?)-->', '', open(md_file, 'r').read())

if 'ee' in directory_file:
md_content = re.sub(r'{% emqxce %}([\s\S]*?){% endemqxce %}', '', md_content)
else:
md_content = re.sub(r'{% emqxee %}([\s\S]*?){% endemqxee %}', '', md_content)

image_list = re.findall('(.*?)!\[(.*?)\]\((.*?)\)', md_content)
url_list = re.findall('(.*?)\[(.*?)\]\((.*?)\)', md_content)
for url in url_list:
if url[0].endswith('!'):
continue
if url[2].startswith(('http://', 'https://', '<', '#', 'mailto:', 'tel:')):
continue
if urlparse(url[2]).path.endswith('.html'):
continue
url_path = url[2].split('.md')[0]
ref_md_path = os.path.join(f'{"/".join(md_file.split("/")[:-1])}/', f'{url_path}.md')

Expand Down Expand Up @@ -56,7 +65,7 @@ def get_md_files(dir_config, path):
if md_name.startswith(('http://', 'https://')):
continue
elif md_name == './':
md_list.append(f'{docs_path}/{path}/README.md')
md_list.append(f'{docs_path}/{path}/index.md')
else:
md_list.append(f'{docs_path}/{path}/{md_name}.md')

Expand All @@ -83,8 +92,6 @@ def get_md_files(dir_config, path):

for file in md_file_list:
check_md_content(file)
else:
sys.exit(f'No {directory_file} file!')

if not success:
sys.exit('No pass!')
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/remove_unused.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def get_markdown_file(dir_config, base_path):
for row in dir_config:
if row.get('path'):
current_files.append(
f'{base_path}/README.md' if row['path'] == './'
f'{base_path}/index.md' if row['path'] == './'
else f'{base_path}/{row["path"]}.md'
)
if row.get('children'):
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/check_markdown.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
name: Check markdown
name: Check Docs

on: [push, pull_request]

jobs:
Markdown_Checker:
markdown_check:
runs-on: ubuntu-latest
steps:
- name: Check out code
- name: check out code
uses: actions/checkout@main
- name: Install markdownlint

- name: install markdownlint
run: sudo npm install -g markdownlint-cli

- name: Check markdown
- name: check markdown
run: markdownlint -c .github/workflows/markdown_config.json ./

Directory_Checker:
directory_check:
runs-on: ubuntu-latest
steps:
- name: Check out code
- name: check out code
uses: actions/checkout@main
- name: Check directory config

- name: check directory config
run: python3 .github/scripts/directory_check.py directory.json $(pwd)
87 changes: 51 additions & 36 deletions .github/workflows/deploy_docs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Deploy Docs

concurrency:
group: ${{ github.ref }}
group: ${{ github.ref_name }}
cancel-in-progress: true

on:
Expand All @@ -17,28 +17,28 @@ jobs:
if: github.repository_owner == 'emqx'
steps:
- name: clone docs
uses: actions/checkout@v2
uses: actions/checkout@main
with:
fetch-depth: 0
path: docs-files

- name: clone frontend
uses: actions/checkout@v2
uses: actions/checkout@main
with:
repository: 'emqx/emqx-io-docs-frontend'
repository: 'emqx/docs-emqx-com-frontend'
ref: next
token: ${{ secrets.CI_GIT_TOKEN }}
path: frontend

- name: use node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 14.15
node-version-file: 'frontend/.nvmrc'

- name: use python
uses: actions/setup-python@v2
- name: use pnpm
uses: pnpm/action-setup@v4
with:
python-version: '3.8'
architecture: 'x64'
version: 8

- name: set env
run: |
Expand All @@ -59,51 +59,66 @@ jobs:
- name: move files
run: |
rm frontend/docs/en/README.md || true
rm frontend/docs/zh/README.md || true
rm frontend/docs/en/index.md || true
rm frontend/docs/zh/index.md || true
rm frontend/docs/*.md || true
rm frontend/README.md
mkdir -p frontend/docs/en/${VERSION}/
mkdir -p frontend/docs/zh/${VERSION}/
mkdir -p frontend/docs/.vuepress/public/api/
cp -r docs-files/en_US/* frontend/docs/en/${VERSION}/
cp -r docs-files/zh_CN/* frontend/docs/zh/${VERSION}/
cp docs-files/directory.json frontend/docs/.vuepress/config/directory.json
rm frontend/index.md || true
mkdir -p frontend/docs/en/${DOCS_TYPE}/${VERSION}/
mkdir -p frontend/docs/zh/${DOCS_TYPE}/${VERSION}/
mkdir -p frontend/docs/public/api/
cp -r docs-files/en_US/* frontend/docs/en/${DOCS_TYPE}/${VERSION}/
cp -r docs-files/zh_CN/* frontend/docs/zh/${DOCS_TYPE}/${VERSION}/
cp docs-files/directory.json frontend/docs/.vitepress/config/directory.json
- name: generate version config
run: |
cd docs-files
python3 .github/scripts/generate_version.py $(git tag | egrep "v(.*)$" | xargs echo -n) > ../frontend/docs/.vuepress/public/api/${DOCS_TYPE}_versions.json
cat ../frontend/docs/.vuepress/public/api/${DOCS_TYPE}_versions.json
python3 .github/scripts/generate_version.py $(git tag | egrep "v(.*)$" | xargs echo -n) > ../frontend/docs/public/api/${DOCS_TYPE}_versions.json
cat ../frontend/docs/public/api/${DOCS_TYPE}_versions.json
- name: build docs
run: |
cd frontend
yarn && yarn build
pnpm install
pnpm build
- name: upload dist
- name: set aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

- name: upload dist to s3
run: |
aws s3 rm --recursive s3://docs-emqx-com/zh/${DOCS_TYPE}/${VERSION} || true
aws s3 rm --recursive s3://docs-emqx-com/en/${DOCS_TYPE}/${VERSION} || true
aws s3 cp --recursive frontend/docs/.vitepress/dist/ s3://docs-emqx-com/
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DOCS_CLOUDFRONT_ID }} --paths "/zh/${DOCS_TYPE}/${VERSION}/*" "/en/${DOCS_TYPE}/${VERSION}/*" "/api/${DOCS_TYPE}_versions.json" "/sitemap_${DOCS_TYPE}_${VERSION}.xml"
- name: upload dist to cos
run: |
pip3 install coscmd
coscmd config -a ${{ secrets.TENCENT_COS_ID }} -s ${{ secrets.TENCENT_COS_KEY }} -b neugates-io-1302406139 -r ap-hongkong
coscmd delete -r -f docs/en/${VERSION} || true
coscmd delete -r -f docs/zh/${VERSION} || true
coscmd config -a ${{ secrets.TENCENT_COS_ID }} -s ${{ secrets.TENCENT_COS_KEY }} -b neugates-io-1302406139 -e cos.accelerate.myqcloud.com
cd frontend/docs/.vuepress/
coscmd upload -r dist/ /docs/
- name: refresh cdn cache
coscmd config -a ${{ secrets.TENCENT_COS_ID }} -s ${{ secrets.TENCENT_COS_KEY }} -b docs-1302406139 -r ap-shanghai
coscmd delete -r -f en/${DOCS_TYPE}/${VERSION} || true
coscmd delete -r -f zh/${DOCS_TYPE}/${VERSION} || true
coscmd config -a ${{ secrets.TENCENT_COS_ID }} -s ${{ secrets.TENCENT_COS_KEY }} -b docs-1302406139 -e cos.accelerate.myqcloud.com
coscmd upload -r frontend/docs/.vitepress/dist/ /
- name: flush cdn
run: |
pip3 install tccli
tccli configure set secretId ${{ secrets.TENCENT_COS_ID }}
tccli configure set secretKey ${{ secrets.TENCENT_COS_KEY }}
tccli configure set region ap-hongkong
tccli cdn PurgePathCache --Paths '["https://neugates.io/docs/", "https://neuron-docs.emqx.net"]' --FlushType delete
tccli configure set region ap-shanghai
tccli cdn PurgePathCache --cli-unfold-argument --Paths https://docs.emqx.com/zh/${DOCS_TYPE}/${VERSION}/ https://docs.emqx.com/en/${DOCS_TYPE}/${VERSION}/ --FlushType delete
tccli cdn PurgeUrlsCache --cli-unfold-argument --Urls https://docs.emqx.com/api/${DOCS_TYPE}_versions.json https://docs.emqx.com/sitemap_${DOCS_TYPE}_${VERSION}.xml
- name: update search index
uses: Swilder-M/docsearch-scraper-simple@v4
uses: Swilder-M/docsearch-scraper-simple@next
env:
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID_NEXT }}
API_KEY: ${{ secrets.ALGOLIA_API_KEY_NEXT }}
with:
docs_type: ${{ env.DOCS_TYPE }}
docs_version: ${{ env.VERSION }}
24 changes: 12 additions & 12 deletions .github/workflows/markdown_config.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"default": false,
"MD001": true,
"MD003": {"style": "atx"},
"MD011": true,
"MD018": true,
"MD019": true,
"MD023": true,
"MD025": {"level": 1, "front_matter_title": ""},
"MD042": true,
"MD046": {"style": "fenced"},
"MD048": {"style": "backtick"}
}
"default": false,
"MD001": true,
"MD003": {"style": "atx"},
"MD011": true,
"MD018": true,
"MD019": true,
"MD023": true,
"MD025": {"level": 1, "front_matter_title": ""},
"MD042": true,
"MD046": {"style": "fenced"},
"MD048": {"style": "backtick"}
}
2 changes: 1 addition & 1 deletion en_US/configuration/south-devices/ads/ads.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ In the context of the ADS plugin, a tag address consists of two components,
`INDEX_GROUP` and `INDEX_OFFSET`, which represents the index group and the
index offset respectively.

> INDEX_GROUP,INDEX_OFFSET</span>
> INDEX_GROUP,INDEX_OFFSET
Both `INDEX_GROUP` and `INDEX_OFFSET` could be in decimal or hexadecimal format.

Expand Down
2 changes: 1 addition & 1 deletion en_US/configuration/south-devices/bacnet-ip/bacnet-ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Neuron supports BACnet IP protocol and can communicate with BACnet devices throu

### Address Format

> AREA[ADDRESS]</span>
> AREA[ADDRESS]
| AREA | ADDRESS RANGE | ATTRIBUTE | DATA TYPE | REMARK |
| ---- | ------------- | ---------- | ------------- | ------------------ |
Expand Down
2 changes: 1 addition & 1 deletion en_US/configuration/south-devices/comli/comli.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This comli plugin is used to access ABB's COMLI compatible control system throug

## Address format

> SLAVE!AREA.ADDRESS\[.BIT][#ENDIAN]\[.LEN\[H]\[L]\[D]\[E]]</span>
> SLAVE!AREA.ADDRESS\[.BIT][#ENDIAN]\[.LEN\[H]\[L]\[D]\[E]]
### **SLAVE**

Expand Down
16 changes: 8 additions & 8 deletions en_US/configuration/south-devices/dlt645-2007/dlt645-2007.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The dlt645 protocol supports serial and tcp connection.

### Address format

> mail_address#DI<sub>3</sub>-DI<sub>2</sub>-DI<sub>1</sub>-DI<sub>0</sub> </span>
> mail_address#DI<sub>3</sub>-DI<sub>2</sub>-DI<sub>1</sub>-DI<sub>0</sub>
* mail_address represents the mailing address of the meter.
* DI<sub>3</sub>-DI<sub>2</sub>-DI<sub>1</sub>-DI<sub>0</sub> represents the data identification, and all points only support read attributes, and expressed in hexadecimal.
Expand All @@ -60,10 +60,10 @@ Please refer to the DL/T645-2007 industry standard data coding table for the spe

| DI<sub>3</sub> | DI<sub>2</sub> | DI<sub>1</sub> | DI<sub>0</sub> | Description | Type of data | Decimal value | Example |
| -------------- | ----------------- | ---------------- | --------------- | -------------------------------- | ------- | --------- | ------------------------------------------------------------ |
| 00 | 00 ~ 0A | 00 ~ 3F | 00 ~ 0C | DI<sub>3</sub>= 00, representing the electrical energy</br>DI<sub>0</sub>, representing the settlement date | UINT64 | 0.01 | 00-00-00-00 Representative (current) combined active total energy</br>00-00-00-01 Representative (last settlement date) combined active total energy |
| 00 | 80~86</br>15~1E</br>94~9A</br>29~32</br>A8~AE</br>3D~46</br>BC~C2 | 00 | 00 ~ 0C | DI<sub>3</sub>= 00, representing the electrical energy</br>DI<sub>0</sub>, representing the settlement date | UINT64 | 0.01 | 00-80-00-00 Representative (current) total associated power</br>00-80-00-01 Representative (last 1 settlement date) associated total power</br>00-15-00-01 Representative (last 1 settlement date) A-phase positive Active energy</br>00-15-00-01 represents (last 2 settlement days) A-phase forward active energy</br> 00-29-00-02 represents (last 2 settlement days) B-phase forward active energy |
| 02 | 01 ~ 09 | 01 ~ 03 | 00 | DI<sub>3</sub>= 02, representing the variable | UINT16</br>UINT32 | 0.1</br>0.01</br>0.001</br>0.0001 | 02-01-01-00 Represents A-phase voltage</br>02-02-01-00 Represents A-phase current |
| 02 | 0A ~ 0B | 01 ~ 03 | 01 ~15 | DI<sub>2</sub>= 0A, representing the voltage harmonic content</br>DI<sub>2</sub> = 0B, representing the current harmonic content</br>DI<sub>1</sub>, representing A, B, C phase</br> DI~0~, representing the th order of harmonic content | UINT16 | 0.01 | 02-0A-01-01 Represents the 1st harmonic content of A-phase voltage</br>02-0A-02-02 represents the 2nd harmonic content of B-phase voltage</br>02-0B-01-01 represents the 1st harmonic content of A-phase current</br>02-0B-02-02 represents the second harmonic content of phase B current |
| 02 | 80 | 00 | 01 ~ 0A | DI<sub>3</sub>= 02, representing the variable | UINT16 | 0.01 | 02-80-00-01 Represents zero line current</br>02-80-00-02 Represents grid frequency |
| 04 | 00 | 01 ~ 0E | 01 ~ 0C | DI<sub>3</sub>= 04, representing the parameter | UINT8</br>UINT16</br>UINT32</br>UINT64 | 0</br>0.1</br>0.001</br>0.0001 | 04-00-01-01 Represents date and time</br>04-00-01-03 represents maximum demand period</br>04-00-04-01 represents communication address</br>04-00-05-01 represents meter running status word 1 |
| 06 | 00 ~ 06 | 00 | 00 ~ 02 | DI<sub>3</sub>= 06, representing the load record | UINT8</br>UINT64 | 0 | 06-00-00-00 Represents the oldest recorded block</br>06-06-00-00 represents the earliest recorded block of class 6 loads |
| 00 | 00 ~ 0A | 00 ~ 3F | 00 ~ 0C | DI<sub>3</sub>= 00, representing the electrical energy<br />DI<sub>0</sub>, representing the settlement date | UINT64 | 0.01 | 00-00-00-00 Representative (current) combined active total energy<br />00-00-00-01 Representative (last settlement date) combined active total energy |
| 00 | 80~86<br />15~1E<br />94~9A<br />29~32<br />A8~AE<br />3D~46<br />BC~C2 | 00 | 00 ~ 0C | DI<sub>3</sub>= 00, representing the electrical energy<br />DI<sub>0</sub>, representing the settlement date | UINT64 | 0.01 | 00-80-00-00 Representative (current) total associated power<br />00-80-00-01 Representative (last 1 settlement date) associated total power<br />00-15-00-01 Representative (last 1 settlement date) A-phase positive Active energy<br />00-15-00-01 represents (last 2 settlement days) A-phase forward active energy<br /> 00-29-00-02 represents (last 2 settlement days) B-phase forward active energy |
| 02 | 01 ~ 09 | 01 ~ 03 | 00 | DI<sub>3</sub>= 02, representing the variable | UINT16<br />UINT32 | 0.1<br />0.01<br />0.001<br />0.0001 | 02-01-01-00 Represents A-phase voltage<br />02-02-01-00 Represents A-phase current |
| 02 | 0A ~ 0B | 01 ~ 03 | 01 ~15 | DI<sub>2</sub>= 0A, representing the voltage harmonic content<br />DI<sub>2</sub> = 0B, representing the current harmonic content<br />DI<sub>1</sub>, representing A, B, C phase<br /> DI~0~, representing the th order of harmonic content | UINT16 | 0.01 | 02-0A-01-01 Represents the 1st harmonic content of A-phase voltage<br />02-0A-02-02 represents the 2nd harmonic content of B-phase voltage<br />02-0B-01-01 represents the 1st harmonic content of A-phase current<br />02-0B-02-02 represents the second harmonic content of phase B current |
| 02 | 80 | 00 | 01 ~ 0A | DI<sub>3</sub>= 02, representing the variable | UINT16 | 0.01 | 02-80-00-01 Represents zero line current<br />02-80-00-02 Represents grid frequency |
| 04 | 00 | 01 ~ 0E | 01 ~ 0C | DI<sub>3</sub>= 04, representing the parameter | UINT8<br />UINT16<br />UINT32<br />UINT64 | 0<br />0.1<br />0.001<br />0.0001 | 04-00-01-01 Represents date and time<br />04-00-01-03 represents maximum demand period<br />04-00-04-01 represents communication address<br />04-00-05-01 represents meter running status word 1 |
| 06 | 00 ~ 06 | 00 | 00 ~ 02 | DI<sub>3</sub>= 06, representing the load record | UINT8<br />UINT64 | 0 | 06-00-00-00 Represents the oldest recorded block<br />06-06-00-00 represents the earliest recorded block of class 6 loads |
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@

### Address Format

> TAG NAME </span>
> TAG NAME
2 changes: 1 addition & 1 deletion en_US/configuration/south-devices/file/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ File plugin is used to read or write files.

### Address Format

> FILE PATH</span>
> FILE PATH
### Address Example

Expand Down
2 changes: 1 addition & 1 deletion en_US/configuration/south-devices/hj212-2017/hj212-2017.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ HJ212-2017 is mainly used to read data that supports the HJ212-2017 standard, th

#### Pollutant real-time data

> RT!xxxx-[Rtd\][Flag\][SampleTime\][EFlag]</span>
> RT!xxxx-[Rtd\][Flag\][SampleTime\][EFlag]
| Address | Type | Description |
| -------------------- | ------ | ------------------------------ |
Expand Down
2 changes: 1 addition & 1 deletion en_US/configuration/south-devices/iec-104/iec-104.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Neuron supports the acquisition of remote signaling, remote measurement, and rem

## Address format

> IOA</span>
> IOA
| IEC 60870-5-104 TYPEID | NEURON TYPE |
| ------------------------------- | ------------ |
Expand Down
2 changes: 1 addition & 1 deletion en_US/configuration/south-devices/iec61850/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The IEC61850 plug-in is used for read/write to the IEC61850 server and currently

## Address forma

> Logical Devices/Logical Nodes$FC$DO$DA</span>
> Logical Devices/Logical Nodes$FC$DO$DA
## Examples

Expand Down
4 changes: 2 additions & 2 deletions en_US/configuration/south-devices/knxnet-ip/knxnet-ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ we recommend that you install Neuron using binary packages.

### Address Format

* > GROUP_ADDRESS,INDIVIDUAL_ADDRESS</span>
* > GROUP_ADDRESS,INDIVIDUAL_ADDRESS
Represents a KNX individual address that is a member of the group address.
When reading the KNX plugin sends a `GroupValueRead` tunnelling request using
Expand All @@ -43,7 +43,7 @@ the specified group address.
`0/0/1,1.1.1` represents a KNX individual address `1.1.1` that is a member
of the group address `0/0/1`.

* > GROUP_ADDRESS,INDIVIDUAL_ADDRESS,BIT</span>
* > GROUP_ADDRESS,INDIVIDUAL_ADDRESS,BIT
Same as above, but for `uint8` values with fewer than 8 bits, such as KNX data point
types `B2` and `B1U3`, etc. *BIT* represents the number of bits.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The a1e plug-in is used to access Mitsubishi's A series, FX3U, FX3G, iQ-F series

### Address Format

> AREA ADDRESS\[.BIT]\[.LEN\[H]\[L]]</span>
> AREA ADDRESS\[.BIT]\[.LEN\[H]\[L]]
#### AREA ADDRESS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The Mitsubishi 3E is fully compatible with the Mitsubishi SLMP protocol.

## Address format

> AREA ADDRESS\[.BIT]\[.LEN\[H]\[L]]</span>
> AREA ADDRESS\[.BIT]\[.LEN\[H]\[L]]
### .BIT

Expand Down
Loading

0 comments on commit d770b79

Please sign in to comment.