Skip to content

Commit ace4a60

Browse files
authored
Initial commit
0 parents  commit ace4a60

18 files changed

+195
-0
lines changed

.github/workflows/publish.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Publishing
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
inputs:
9+
source_branch:
10+
description: 'Source branch'
11+
required: true
12+
default: 'main'
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
publish:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.source_branch || github.ref }}
25+
submodules: recursive
26+
27+
- name: Check if should be published
28+
if: ${{ github.event_name != 'workflow_dispatch' && !contains(github.event.head_commit.message, '[pub]') }}
29+
run: |
30+
echo "[pub] string is missing in commit message, skipping ..."
31+
exit 0
32+
33+
- name: Get Fulltext search index builder
34+
env:
35+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
mkdir -p _ftsbuilder
38+
git clone https://x-access-token:${TOKEN}@github.com/HelpViewer/fulltextSearchDBBuilder.git _ftsbuilder
39+
40+
- name: Publish
41+
id: pub
42+
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[pub]') }}
43+
run: |
44+
echo "::group::Copy _invariant to all language directories, package them"
45+
mkdir -p _output
46+
echo "Base folder for help ..."
47+
FOLDER="_base"
48+
if [ -d "$FOLDER" ] && [ "$(ls -A $FOLDER)" ]; then
49+
cd "$FOLDER"
50+
zip -r -9 ../_output/Help-.zip .
51+
cd ..
52+
else
53+
echo "Directory $FOLDER not exists, skipping ..."
54+
fi
55+
echo "End : Base folder for help"
56+
57+
SRC_DIR="_invariant"
58+
mkdir -p $SRC_DIR
59+
echo "::endgroup::"
60+
61+
langdirs=$(find . -maxdepth 1 -type d ! -name '.' ! -name '.*' ! -name '_*' -printf '%P\n' | paste -sd';')
62+
63+
for dir in */ ; do
64+
dir=${dir%/}
65+
echo "::group::Language: $dir"
66+
67+
case "$dir" in
68+
_*) continue ;;
69+
esac
70+
71+
echo "Copying language invariant data ..."
72+
cp -r -T -v "$SRC_DIR"/. "$dir"/
73+
cd $dir
74+
echo "_lang|$dir" >> _config.txt
75+
echo "_langs|$langdirs" >> _config.txt
76+
echo "::endgroup::"
77+
[ -f "./fts-keywords.lst" ] && bash ../_ftsbuilder/indexBuild.sh "." "$dir"
78+
echo "::group::Language: $dir - zipping directory"
79+
echo "Zipping ..."
80+
zip -r -9 ../_output/Help-$dir.zip .
81+
cd ..
82+
echo "Language: $dir done."
83+
echo "::endgroup::"
84+
done
85+
echo "exists=true" >> $GITHUB_OUTPUT
86+
echo "Bundling finished."
87+
88+
- name: Create tag
89+
id: newtag
90+
if: steps.pub.outputs.exists == 'true'
91+
run: |
92+
echo "::group::Version overview"
93+
VERSION=$(awk '/^## /{print $2; exit}' CHANGELOG.md)
94+
BODY=$(awk '/^## /{if (seen++) exit} seen' CHANGELOG.md | tail -n +2)
95+
echo "version=$VERSION" >> $GITHUB_OUTPUT
96+
echo "body<<EOF" >> $GITHUB_OUTPUT
97+
echo "$BODY" >> $GITHUB_OUTPUT
98+
echo "EOF" >> $GITHUB_OUTPUT
99+
echo "::endgroup::"
100+
101+
TAG="$VERSION"
102+
103+
echo "::group::Old release delete"
104+
RELEASE_ID=$(curl -s -H "Authorization: token $TOKEN" \
105+
https://api.github.com/repos/$REPO/releases/tags/$TAG | jq -r .id)
106+
107+
if [ "$RELEASE_ID" != "null" ]; then
108+
echo "Deleting release ID $RELEASE_ID"
109+
curl -s -X DELETE -H "Authorization: token $TOKEN" \
110+
https://api.github.com/repos/$REPO/releases/$RELEASE_ID
111+
fi
112+
echo "::endgroup::"
113+
114+
echo "::group::Old tag delete"
115+
if git ls-remote --tags origin | grep -q "$TAG"; then
116+
git tag -d "$TAG" || true
117+
git push origin ":refs/tags/$TAG" || true
118+
fi
119+
echo "::endgroup::"
120+
121+
echo "::group::New tag created"
122+
echo "tag=$TAG" >> $GITHUB_OUTPUT
123+
git tag $TAG
124+
git push origin $TAG || true
125+
echo "::endgroup::"
126+
127+
- name: Create release
128+
id: crelease
129+
if: steps.pub.outputs.exists == 'true'
130+
uses: actions/create-release@v1
131+
with:
132+
tag_name: ${{ steps.newtag.outputs.tag }}
133+
release_name: ${{ steps.newtag.outputs.tag }}
134+
body: ${{ steps.newtag.outputs.body }}
135+
env:
136+
GITHUB_TOKEN: ${{ secrets._TOKEN }}
137+
138+
- name: Upload helps for languages
139+
if: steps.pub.outputs.exists == 'true'
140+
env:
141+
GITHUB_TOKEN: ${{ secrets._TOKEN }}
142+
TAG: ${{ steps.newtag.outputs.tag }}
143+
REPO: ${{ github.repository }}
144+
run: |
145+
cd _output
146+
147+
find . -type f -name "*.zip" -print0 | while IFS= read -r -d '' file; do
148+
echo "Language bundle to upload: $file"
149+
unzip "$file" _config.txt
150+
echo "_version|$TAG" >> _config.txt
151+
echo "_prjname|$REPO" >> _config.txt
152+
zip -u -o "$file" _config.txt
153+
rm _config.txt
154+
gh release upload "$TAG" "$file" --repo "$REPO" --clobber
155+
done

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## 20250613
4+
- 1st version of documentation
5+
6+
## Introduced
7+
- File introduced

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 HelpViewer
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# helpTemplate
2+
Help file base template

cs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Main chapter

cs/_config.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OverrideBookIcon-opened|&#128214;
2+
OverrideBookIcon-closed|&#128216;

cs/files.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md|Overview

cs/fts-keywords.lst

Whitespace-only changes.

cs/keywords-files.lst

Whitespace-only changes.

cs/keywords.lst

Whitespace-only changes.

0 commit comments

Comments
 (0)