Skip to content

Commit

Permalink
config doc algolia
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Feb 5, 2024
1 parent 71cce91 commit f58180e
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 12 deletions.
58 changes: 50 additions & 8 deletions .github/workflows/deploy-website-v4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

paths:
- 'Writerside/**'
- '.github/workflows/deploy-website-v4.yml'
# Specify to run a workflow manually from the Actions tab on GitHub
workflow_dispatch:

Expand All @@ -20,16 +21,20 @@ env:
# Name of module and id separated by a slash
INSTANCE: Writerside/d
# Replace HI with the ID of the instance in capital letters
ARTIFACT: webHelpD2-all.zip
ARTIFACT: webHelpKOOK2-all.zip
# Writerside docker image version
DOCKER_VERSION: 233.14272
# Add the variable below to upload Algolia indexes
# Replace HI with the ID of the instance in capital letters
# ALGOLIA_ARTIFACT: algolia-indexes-HI.zip
ALGOLIA_ARTIFACT: algolia-indexes-KOOK.zip
ALGOLIA_APP_NAME: VLLZ4JZE8Z
ALGOLIA_INDEX_NAME: kook-doc

jobs:
build:
runs-on: ubuntu-latest
outputs:
config_json: ${{ steps.output-config-json.outputs.config_json }}

steps:
- name: Checkout repository
Expand All @@ -52,12 +57,20 @@ jobs:
retention-days: 7

# Add the step below to upload Algolia indexes
# - name: Upload algolia-indexes
# uses: actions/upload-artifact@v3
# with:
# name: algolia-indexes
# path: artifacts/${{ env.ALGOLIA_ARTIFACT }}
# retention-days: 7
- name: Upload algolia-indexes
uses: actions/upload-artifact@v3
with:
name: algolia-indexes
path: artifacts/${{ env.ALGOLIA_ARTIFACT }}
retention-days: 7

- name: Unzip artifact
run: unzip -O UTF-8 -qq artifacts/${{ env.ARTIFACT }} -d dir

- name: Output documentation config.json
id: output-config-json
run: |
echo "config_json=$(cat dir/config.json)" >> $GITHUB_OUTPUT
# Add the job below and artifacts/report.json on Upload documentation step above if you want to fail the build when documentation contains errors
test:
Expand Down Expand Up @@ -105,3 +118,32 @@ jobs:
id: deployment
uses: actions/deploy-pages@v1

# https://www.jetbrains.com/help/writerside/configure-search.html
publish-indexes:
# Requires the build-job results
needs: [build, test]
runs-on: ubuntu-latest
container:
image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-2

env:

CONFIG_JSON_VERSION: ${{ fromJSON(needs.build.outputs.config_json).productVersion }}

steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: algolia-indexes

- name: Unzip artifact
run: |
unzip -O UTF-8 -qq ${{ env.ALGOLIA_ARTIFACT }} -d algolia-indexes
env "algolia-key=${{secrets.ALGOLIA_KEY}}" java -jar /opt/builder/help-publication-agent.jar \
update-index \
--application-name ${{env.ALGOLIA_APP_NAME}} \
--index-name ${{env.ALGOLIA_INDEX_NAME}} \
--product ${{env.INSTANCE_NAME}} \
--version ${{env.CONFIG_JSON_VERSION}} \
--index-directory algolia-indexes/ \
2>&1 | tee algolia-update-index-log.txt
8 changes: 6 additions & 2 deletions Writerside/cfg/buildprofiles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
<download-title>GitHub</download-title>
<download-page>https://github.com/simple-robot/simbot-component-kook/</download-page>
<showDownloadButton>true</showDownloadButton>
<!-- <browser-edits-url>https://github.com/simple-robot-library/simbot4-website/tree/master/Writerside/</browser-edits-url>-->
<browser-edits-url>https://github.com/simple-robot/simbot-component-kook/tree/dev/main/Writerside/</browser-edits-url>
<enable-browser-edits>true</enable-browser-edits>
<locale-code>zh-CN</locale-code>
<noindex-content>false</noindex-content>
<algolia-id>VLLZ4JZE8Z</algolia-id>
<algolia-index>kook-doc</algolia-index>
<algolia-api-key>e60d9ee16618a0ad3a338ecc73cb840e</algolia-api-key>
<web-root>http://component-kook.simbot.forte.love</web-root>
</variables>

<build-profile instance="d">
<build-profile instance="kook">
<variables>
<noindex-content>false</noindex-content>
</variables>
Expand Down
2 changes: 1 addition & 1 deletion Writerside/d.tree → Writerside/kook.tree
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE instance-profile
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">

<instance-profile id="d"
<instance-profile id="kook"
name="Simple Robot | KOOK"
start-page="welcome.md">

Expand Down
2 changes: 1 addition & 1 deletion Writerside/writerside.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<ihp version="2.0">
<topics dir="topics" web-path="topics"/>
<images dir="images" web-path="images"/>
<instance src="d.tree" web-path="/d/" version="v%version%"/>
<instance src="kook.tree" version="v%version%"/>
</ihp>

0 comments on commit f58180e

Please sign in to comment.