✨ [2025-06-26] 测试 workflow
Some checks failed
Publish to Confluence / confluence (push) Failing after 16s
Some checks failed
Publish to Confluence / confluence (push) Failing after 16s
This commit is contained in:
parent
e516f21e36
commit
dd4df738f8
@ -1,7 +1,7 @@
|
||||
name: Publish to Confluence
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [ test ]
|
||||
# paths:
|
||||
# - '**'
|
||||
# - '!.gitignore'
|
||||
@ -13,7 +13,6 @@ on:
|
||||
env:
|
||||
SEPARATOR: "," # 定义多文件分割符
|
||||
START_PREFIX: "<!--" # 定义需要同步的文件
|
||||
HOME: ./.git
|
||||
|
||||
jobs:
|
||||
confluence:
|
101
.gitea/workflows/confluence-sync-host.yaml
Normal file
101
.gitea/workflows/confluence-sync-host.yaml
Normal file
@ -0,0 +1,101 @@
|
||||
name: Publish to Confluence
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
# paths:
|
||||
# - '**'
|
||||
# - '!.gitignore'
|
||||
# - '!README.md'
|
||||
# workflow_dispatch: # 允许手动触发工作流
|
||||
# schedule:
|
||||
# # 每天晚六点十分执行一次
|
||||
# - cron: '10 10 * * *'
|
||||
env:
|
||||
SEPARATOR: "," # 定义多文件分割符
|
||||
START_PREFIX: "<!--" # 定义需要同步的文件
|
||||
HOME: ./.git
|
||||
|
||||
jobs:
|
||||
confluence:
|
||||
runs-on: linux-ubuntu-24.04
|
||||
|
||||
steps:
|
||||
# 检出文件
|
||||
- uses: https://texous.cn/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Print current path
|
||||
run: |
|
||||
pwd
|
||||
ls
|
||||
|
||||
# 获取变更的文件
|
||||
- name: Get changed files
|
||||
id: changed-markdown-files
|
||||
uses: https://texous.cn/actions/changed-files@v44.5.5
|
||||
with:
|
||||
files: |
|
||||
**.md
|
||||
**.png
|
||||
files_ignore: |
|
||||
**.tpl.md
|
||||
quotepath: false
|
||||
separator: ${{env.SEPARATOR}}
|
||||
old_new_files_separator: ";"
|
||||
|
||||
# 打印所有变更的文件
|
||||
- name: Print all changed files
|
||||
if: steps.changed-markdown-files.outputs.any_changed == 'true'
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
|
||||
run: |
|
||||
IFS=${SEPARATOR}
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
echo "$file was changed, realfile $(echo $file | tr -d '\\')"
|
||||
done
|
||||
|
||||
# 构建添加 mark 指令
|
||||
# - name: Setup mark
|
||||
# if: steps.changed-markdown-files.outputs.any_changed == 'true'
|
||||
# uses: https://texous.cn/actions/setup-mark-action@v2.0.1
|
||||
# with:
|
||||
# version: 11.3.0
|
||||
# url_prefix: https://texous.cn/actions/mark
|
||||
|
||||
# 编译以及发布到
|
||||
- name: Mark and to confluence
|
||||
if: steps.changed-markdown-files.outputs.any_changed == 'true'
|
||||
env:
|
||||
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
|
||||
MARK_USER: ${ATLASSIAN_USERNAME}
|
||||
MARK_PASS: ${ATLASSIAN_API_TOKEN}
|
||||
MARK_URL: ${ATLASSIAN_BASE_URL}
|
||||
run: |
|
||||
IFS=${SEPARATOR}
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
if [[ $(head -n 1 $(echo $file | tr -d '\\')) =~ ^$START_PREFIX ]]; then
|
||||
export temp_path=$(echo $file | tr -d '\\')
|
||||
export temp_filename=${temp_path##*/}
|
||||
export temp_filename=${temp_filename%.*}
|
||||
export temp_filename=${temp_filename%.*}
|
||||
echo "file: $temp_path, filename: $temp_filename"
|
||||
# 打印文件第一行信息
|
||||
head -n 1 $(echo $file | tr -d '\\')
|
||||
# 配置图片大小为 750
|
||||
# sed -i -E 's/(.*\!\[.*\]\(.*\))([ ]*<\!\-\-[ ]*width=[0-9]*[ ]*\-\->)*/\1<!-- width=750 -->/g' $temp_path
|
||||
# path 替换
|
||||
# sed -i -E 's/(.*\!\[.*\]\([ \t]*([a-zA-Z]\:)?(\.*(\/|\\))?([^:\r\n\t\!]*\.[a-zA-Z]+)[ \t]*\))([ ]*<\!\-\-[ \t]*width=[0-9]*[ \t]*\-\->)*/\1<!-- width-attach=750 -->/g' $temp_path
|
||||
# url 替换
|
||||
sed -i -E 's/(.*\!\[.*\]\([ \t]*(http(s)?:\/\/)([^:\r\n\t\!]*(\.[a-zA-Z]+)?)[ \t]*\))([ ]*<\!\-\-[ \t]*width=[0-9]*[ \t]*\-\->)*/\1<!-- width=750 -->/g' $temp_path
|
||||
# 不支持的代码块替换
|
||||
sed -i -E 's/(.*)(```(dockerfile|json|toml|properties))(.*)/\1```shell\4/g' $temp_path
|
||||
# 标题添加锚点
|
||||
sed -i -E 's/([#]+[ ]+)(.*)/\1\2 :anchor(\2):/g' $temp_path
|
||||
sed -i -E "s@(\[.*\])(\(#)(.*)(\))@\1\2id-$(echo $temp_filename | tr -d '-')-\3\4@g" $temp_path
|
||||
# 构建及发布
|
||||
/usr/local/programs/gitea/gitea_runner_host/mark --ci --debug --trace --include-path $(pwd) -p $MARK_PASS -b $MARK_URL -f $temp_path || exit 1;
|
||||
else
|
||||
echo "$temp_path not config metadata info, ignore file"
|
||||
fi
|
||||
done
|
@ -106,4 +106,3 @@ qifu:
|
||||
- lazada联调问题修复
|
||||
- 新员工入职信息发送
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user