This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch refactor/add-info-yaml
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
The following commit(s) were added to refs/heads/refactor/add-info-yaml by this
push:
new f529d09 chore: Sync version
f529d09 is described below
commit f529d091ab3142869b47859c9462367ff0305350
Author: robin <[email protected]>
AuthorDate: Wed Jul 3 16:14:45 2024 +0800
chore: Sync version
---
.github/workflows/sync-version.yml | 45 ++++++++++++++++++++++++++++++++++++++
script/sync-info.sh | 36 ++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+)
diff --git a/.github/workflows/sync-version.yml
b/.github/workflows/sync-version.yml
new file mode 100644
index 0000000..4c24669
--- /dev/null
+++ b/.github/workflows/sync-version.yml
@@ -0,0 +1,45 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Sync version
+on:
+ pull_request:
+ branches: [main]
+ push:
+ branches: [main, refactor/add-info-yaml]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Run script
+ run: script/sync-version.sh
+
+ - name: Create pull request
+ uses: peter-evans/create-pull-request@v5
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ commit-message: "chore: Sync version"
+ title: "chore: Sync version"
+ body: "Sync version"
+ branch: "chore/sync-package-version"
+ base: "main"
+
+
\ No newline at end of file
diff --git a/script/sync-info.sh b/script/sync-info.sh
new file mode 100755
index 0000000..7531501
--- /dev/null
+++ b/script/sync-info.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+
+# 设置项目根目录
+project_root="."
+
+# 遍历项目目录下的所有文件夹
+for dir in $(find "$project_root" -type d); do
+ if [[ "$dir" == *node_modules* ]] || [[ "$dir" == *.git* ]] || [[ "$dir"
== *.vscode* ]]; then
+ continue
+ fi
+
+ if [ -f "$dir/info.yaml" ]; then
+ version=$(awk '/version:/{print $2}' "$dir/info.yaml")
+
+ if [ -f "$dir/package.json" ]; then
+ sed -i '' -E 's/"version": "[0-9]+\.[0-9]+\.[0-9]+"/"version":
"'$version'"/' "$dir/package.json"
+ fi
+ fi
+done