@@ -104,34 +104,43 @@ jobs:
104104 # wranglerVersion: 3.101.0
105105
106106# see: https://youtrack.jetbrains.com/issue/WRS-7233/Algolia-publisher-2.0.32-3-fails-with-UnrecognizedPropertyException-for-contentBoost-field-generated-by-Writerside-builder
107- # publish-indexes:
108- # needs: [ build, test, deploy ]
109- # runs-on: ubuntu-latest
110- # container:
111- # image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:latest
112- #
113- # steps:
114- # - name: Download artifact
115- # uses: actions/download-artifact@v4
116- # with:
117- # name: docs
118- # path: artifacts
119- #
120- # - name: Unzip Algolia artifact
121- # run: unzip -O UTF-8 -qq "artifacts/${{ needs.build.outputs.algolia_artifact }}" -d algolia-indexes
122- #
123- # - name: Update Algolia Index
124- # run: |
125- # if [ -z "${{ secrets.ALGOLIA_KEY }}" ]; then
126- # echo "ALGOLIA_KEY secret is not set in GitHub Secrets"
127- # exit 1
128- # else
129- # env "algolia-key=${{ secrets.ALGOLIA_KEY }}" java -jar /opt/builder/help-publication-agent.jar \
130- # update-index \
131- # --application-name ${{ env.ALGOLIA_APP_NAME }} \
132- # --index-name ${{ env.ALGOLIA_INDEX_NAME }} \
133- # --product ${{ env.CONFIG_JSON_PRODUCT }} \
134- # --version ${{ env.CONFIG_JSON_VERSION }} \
135- # --index-directory algolia-indexes/ \
136- # 2>&1 | tee algolia-update-index-log.txt
137- # fi
107+ publish-indexes :
108+ needs : [ build, test, deploy ]
109+ runs-on : ubuntu-latest
110+ container :
111+ image : registry.jetbrains.team/p/writerside/builder/algolia-publisher:latest
112+
113+ steps :
114+ - name : Download artifact
115+ uses : actions/download-artifact@v4
116+ with :
117+ name : docs
118+ path : artifacts
119+
120+ - name : Unzip Algolia artifact
121+ run : unzip -O UTF-8 -qq "artifacts/${{ needs.build.outputs.algolia_artifact }}" -d algolia-indexes
122+
123+ - name : Remove contentBoost field from index files
124+ run : |
125+ apt-get update && apt-get install -y jq
126+ cd algolia-indexes
127+ for f in *.json; do
128+ [ -e "$f" ] || continue
129+ jq 'walk(if type == "object" then del(.contentBoost) else . end)' "$f" > tmp.json && mv tmp.json "$f"
130+ done
131+
132+ - name : Update Algolia Index
133+ run : |
134+ if [ -z "${{ secrets.ALGOLIA_KEY }}" ]; then
135+ echo "ALGOLIA_KEY secret is not set in GitHub Secrets"
136+ exit 1
137+ else
138+ env "algolia-key=${{ secrets.ALGOLIA_KEY }}" java -jar /opt/builder/help-publication-agent.jar \
139+ update-index \
140+ --application-name ${{ env.ALGOLIA_APP_NAME }} \
141+ --index-name ${{ env.ALGOLIA_INDEX_NAME }} \
142+ --product ${{ env.CONFIG_JSON_PRODUCT }} \
143+ --version ${{ env.CONFIG_JSON_VERSION }} \
144+ --index-directory algolia-indexes/ \
145+ 2>&1 | tee algolia-update-index-log.txt
146+ fi
0 commit comments