Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-06-01 10:13:04 +08:00
commit fef9332d82
9 changed files with 692 additions and 32 deletions

View file

@ -24,17 +24,20 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10"
- run: pip install PyGithub
- name: Gather Release Information
id: release_info
run: |
echo "::set-output name=release_title::$(git show --format=%s --no-patch | head -1)"
echo "::set-output name=release_version::$(TZ=Asia/Shanghai date +'v%Y%m%d%H%M')"
changelog=$(python scripts/parse-changelog.py CHANGE_LOGS.md)
changelog=$(python scripts/parse-changelog.py -t ${{ github.ref }} siyuan-note/siyuan)
changelog="${changelog//'%'/'%25'}"
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "::set-output name=release_body::$changelog"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version from package.json
uses: sergeysova/jq-action@v2
@ -50,7 +53,7 @@ jobs:
with:
release_name: ${{ steps.release_info.outputs.release_version }}
tag_name: ${{ github.ref }}
body: ${{ github.ref }}
body: ${{ steps.release_info.outputs.release_body }}
draft: false
prerelease: true

128
CODE_OF_CONDUCT.md Normal file
View file

@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
os@b3log.org.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

2
DEV.md
View file

@ -27,7 +27,7 @@ NPM mirror:
* `cd kernel`
* `go build --tags "fts5" -o "../app/kernel/SiYuan-Kernel.exe"`
* `SiYuan-Kernel.exe --wd=D:/siyuan/app`
* `SiYuan-Kernel.exe --wd=D:/siyuan/app --mode=dev`
### iOS

View file

@ -27,7 +27,7 @@ NPM 镜像:
* `cd kernel`
* `go build --tags "fts5" -o "../app/kernel/SiYuan-Kernel.exe"`
* `SiYuan-Kernel.exe --wd=D:/siyuan/app`
* `SiYuan-Kernel.exe --wd=D:/siyuan/app --mode=dev`
### iOS

View file

@ -5,7 +5,7 @@
"id": "20200924100717-yzwzn64",
"title": "Kernel parameter",
"type": "doc",
"updated": "20220517144139"
"updated": "20220601091217"
},
"Children": [
{
@ -612,6 +612,161 @@
"Data": "."
}
]
},
{
"ID": "20220601091217-g6ohtlq",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20220601091217-g6ohtlq",
"updated": "20220601091217"
},
"Children": [
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
}
]
},
{
"ID": "20220601091217-monzwye",
"Type": "NodeParagraph",
"Properties": {
"id": "20220601091217-monzwye",
"updated": "20220601091217"
},
"Children": [
{
"Type": "NodeText",
"Data": "Use "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode=dev"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " to run in development mode, use "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode=prod"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " to run in production mode, default "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "prod"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": "."
}
]
},
{
"ID": "20220601091217-nnqyj25",
"Type": "NodeParagraph",
"Properties": {
"id": "20220601091217-nnqyj25",
"updated": "20220601091217"
},
"Children": [
{
"Type": "NodeText",
"Data": "The main difference between development mode and production mode is that development mode uses "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "working directory/appearance/"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " as the appearance folder, while production mode uses "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "workspace/conf/appearance/"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": "."
}
]
}
]
}

View file

@ -5,7 +5,7 @@
"id": "20200828105441-r76vmu5",
"title": "内核参数",
"type": "doc",
"updated": "20220517144043"
"updated": "20220601091012"
},
"Children": [
{
@ -982,6 +982,161 @@
}
}
]
},
{
"ID": "20220601085956-e4x7vfb",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20220601085956-e4x7vfb",
"updated": "20220601085956"
},
"Children": [
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
}
]
},
{
"ID": "20220601085956-ckohzhm",
"Type": "NodeParagraph",
"Properties": {
"id": "20220601085956-ckohzhm",
"updated": "20220601090148"
},
"Children": [
{
"Type": "NodeText",
"Data": "使用 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode=dev"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " 后将使用开发模式运行,使用 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode=prod"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " 将使用生产模式运行,默认 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "prod"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": "。"
}
]
},
{
"ID": "20220601090153-w4lmqvd",
"Type": "NodeParagraph",
"Properties": {
"id": "20220601090153-w4lmqvd",
"updated": "20220601091012"
},
"Children": [
{
"Type": "NodeText",
"Data": "开发模式和生产模式的主要区别开发模式会使用 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "工作目录/appearance/"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " 作为外观文件夹,而生产模式使用的是 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "工作空间/conf/appearance/"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": "。"
}
]
}
]
}

View file

@ -4,7 +4,7 @@
"Properties": {
"id": "20211226122358-hctqcn5",
"title": "Kernel 參數",
"updated": "20220517144244"
"updated": "20220601091200"
},
"Children": [
{
@ -981,6 +981,161 @@
}
}
]
},
{
"ID": "20220601091152-z1gdkxi",
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20220601091152-z1gdkxi",
"updated": "20220601091152"
},
"Children": [
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
}
]
},
{
"ID": "20220601091152-fx2ojfv",
"Type": "NodeParagraph",
"Properties": {
"id": "20220601091152-fx2ojfv",
"updated": "20220601091200"
},
"Children": [
{
"Type": "NodeText",
"Data": "使用 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode=dev"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " 後將使用開發模式運行,使用 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "--mode=prod"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " 將使用生產模式運行,預設 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "prod"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": "。"
}
]
},
{
"ID": "20220601091152-7qrn8ca",
"Type": "NodeParagraph",
"Properties": {
"id": "20220601091152-7qrn8ca",
"updated": "20220601091152"
},
"Children": [
{
"Type": "NodeText",
"Data": "開發模式和生產模式的主要區別開發模式會使用 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "工作目錄/appearance/"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": " 作為外觀文件夾,而生產模式使用的是 "
},
{
"Type": "NodeCodeSpan",
"Data": "code",
"Children": [
{
"Type": "NodeCodeSpanOpenMarker"
},
{
"Type": "NodeCodeSpanContent",
"Data": "工作空間/conf/appearance/"
},
{
"Type": "NodeCodeSpanCloseMarker"
}
]
},
{
"Type": "NodeText",
"Data": "。"
}
]
}
]
}

View file

@ -63,7 +63,7 @@ func Boot() {
accessAuthCode := flag.String("accessAuthCode", "", "access auth code")
ssl := flag.Bool("ssl", false, "for https and wss")
lang := flag.String("lang", "en_US", "zh_CN/zh_CHT/en_US/fr_FR")
mode := flag.String("mode", "prod", "dev/prod")
flag.Parse()
if "" != *wdPath {
@ -72,6 +72,7 @@ func Boot() {
if "" != *lang {
Lang = *lang
}
Mode = *mode
Resident = *resident
ReadOnly = *readOnly
AccessAuthCode = *accessAuthCode

View file

@ -1,32 +1,95 @@
#!/usr/bin/env python3
from pathlib import Path
import os
import re
from argparse import ArgumentParser
from collections import defaultdict
import github
docmap = {
"Enhancement": "改进功能",
"Document": "文档相关",
"Refactor": "开发重构",
"Bug": "修复缺陷",
"Features": "引入特性",
"Abolishments": "移除功能"
}
def parse_latest_changelog(text: str) -> str:
"""Read the contents between the first `##` and the second `##`"""
recording = False
contents: list[str] = []
for line in text.splitlines():
if line.strip().startswith("## ") and recording is False:
recording = True
elif line.strip().startswith("## ") and recording is True:
break
if recording:
contents.append(line)
def generate_msg_from_repo(repo_name, tag_name):
"""Generate changelog messages from repository and tag name.
return "\n".join(contents[1:])
Envs:
GITHUB_HOST: the custom github host.
GITHUB_TOKEN: the github access token.
Args:
repo_name (str): The repository name
tag_name (str): the tag name
"""
hostname = os.getenv("GITHUB_HOST") or "api.github.com"
token = os.getenv("GITHUB_TOKEN")
desc_mapping = defaultdict(list)
gh = github.Github(token, base_url=f"https://{hostname}")
repo = gh.get_repo(repo_name)
milestone = find_milestone(repo, tag_name)
for issue in repo.get_issues(state="closed", milestone=milestone):
desc_mapping[get_issue_first_label(issue)].append(
{"title": issue.title, "url": issue.url}
)
generate_msg(desc_mapping)
def get_changelog() -> str:
parser = ArgumentParser(description="Get the latest change log from CHANG_LOGS.md")
parser.add_argument("changelog_file", help="The path of CHANGE_LOGS.md")
def find_milestone(repo, title):
"""Find the milestone in a repository that is similar to milestone title
Args:
repo (github.repository.Repository): The repository to search
title (str): the title to match
Returns:
The milestone which title matches the given argument.
If no milestone matches, it will return None
"""
pat = re.search("v([0-9.]+)", title)
if not pat:
return None
version = pat.group(1)
for milestone in repo.get_milestones():
if version in milestone.title:
return milestone
def get_issue_first_label(issue):
"""Get the first label from issue, if no labels, return empty string."""
for label in issue.get_labels():
if label.name in docmap:
return label.name
return ""
def generate_msg(desc_mapping):
"""Print changelogs from direction."""
print()
for header in docmap:
if not desc_mapping[header]:
continue
print(f"### {docmap[header]}\n")
for item in desc_mapping[header]:
print(f"* [{item['title']}]({item['url']})")
print()
if __name__ == "__main__":
parser = ArgumentParser(
description="Automaticly generate information from issues by tag."
)
parser.add_argument("-t", "--tag", help="the tag to filter issues.")
parser.add_argument("repo", help="The repository name")
args = parser.parse_args()
with Path(args.changelog_file).open() as f:
return f.read()
if __name__ == '__main__':
changelog = get_changelog()
latest_changelog = parse_latest_changelog(changelog)
print(latest_changelog)
try:
generate_msg_from_repo(args.repo, args.tag)
except AssertionError:
print(args.tag)