2020 # Replace HI with the ID of the instance in capital letters
2121 ARTIFACT : webHelpCCS2-all.zip
2222 # Writerside docker image version
23- DOCKER_VERSION : 243.21565
23+ DOCKER_VERSION : 243.22562
2424
2525 # Add the variable below to upload Algolia indexes
2626 # Replace HI with the ID of the instance in capital letters
3434jobs :
3535 build :
3636 runs-on : ubuntu-latest
37+ outputs :
38+ algolia_artifact : ${{ steps.define-ids.outputs.algolia_artifact }}
39+ artifact : ${{ steps.define-ids.outputs.artifact }}
3740 steps :
3841 - name : Checkout repository
3942 uses : actions/checkout@v4
4043 with :
4144 fetch-depth : 0
4245
46+ - name : Define instance id and artifacts
47+ id : define-ids
48+ run : |
49+ INSTANCE=${INSTANCE#*/}
50+ INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]')
51+ ARTIFACT="webHelp${INSTANCE_ID_UPPER}2-all.zip"
52+ ALGOLIA_ARTIFACT="algolia-indexes-${INSTANCE_ID_UPPER}.zip"
53+
54+ # Print the values
55+ echo "INSTANCE_ID_UPPER: $INSTANCE_ID_UPPER"
56+ echo "ARTIFACT: $ARTIFACT"
57+ echo "ALGOLIA_ARTIFACT: $ALGOLIA_ARTIFACT"
58+
59+ # Set the environment variables and outputs
60+ echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV
61+ echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV
62+ echo "ALGOLIA_ARTIFACT=$ALGOLIA_ARTIFACT" >> $GITHUB_ENV
63+ echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT
64+ echo "algolia_artifact=$ALGOLIA_ARTIFACT" >> $GITHUB_OUTPUT
65+
4366 - name : Build docs using Writerside Docker builder
4467 uses : JetBrains/writerside-github-action@v4
4568 with :
@@ -87,9 +110,10 @@ jobs:
87110 uses : actions/download-artifact@v4
88111 with :
89112 name : docs
113+ path : artifacts
90114
91115 - name : Unzip artifact
92- run : unzip -O UTF-8 -qq ' ${{ env.ARTIFACT }}' -d cf-pages
116+ run : unzip -O UTF-8 -qq "artifacts/ ${{ needs.build.outputs.artifact }}" -d cf-pages
93117
94118 - name : Publish to Cloudflare Pages
95119 uses :
cloudflare/[email protected] @@ -113,14 +137,23 @@ jobs:
113137 uses : actions/download-artifact@v4
114138 with :
115139 name : docs
116- - name : Unzip artifact
140+ path : artifacts
141+
142+ - name : Unzip Algolia artifact
143+ run : unzip -O UTF-8 -qq "artifacts/${{ needs.build.outputs.algolia_artifact }}" -d algolia-indexes
144+
145+ - name : Update Algolia Index
117146 run : |
118- unzip -O UTF-8 -qq '${{ env.ALGOLIA_ARTIFACT }}' -d algolia-indexes
119- env algolia-key='${{env.ALGOLIA_KEY}}' java -jar /opt/builder/help-publication-agent.jar \
120- update-index \
121- --application-name '${{env.ALGOLIA_APP_NAME}}' \
122- --index-name '${{env.ALGOLIA_INDEX_NAME}}' \
123- --product '${{env.CONFIG_JSON_PRODUCT}}' \
124- --version '${{env.CONFIG_JSON_VERSION}}' \
125- --index-directory algolia-indexes/ \
126- 2>&1 | tee algolia-update-index-log.txt
147+ if [ -z "${{ secrets.ALGOLIA_KEY }}" ]; then
148+ echo "ALGOLIA_KEY secret is not set in GitHub Secrets"
149+ exit 1
150+ else
151+ env "algolia-key=${{ secrets.ALGOLIA_KEY }}" java -jar /opt/builder/help-publication-agent.jar \
152+ update-index \
153+ --application-name ${{ env.ALGOLIA_APP_NAME }} \
154+ --index-name ${{ env.ALGOLIA_INDEX_NAME }} \
155+ --product ${{ env.CONFIG_JSON_PRODUCT }} \
156+ --version ${{ env.CONFIG_JSON_VERSION }} \
157+ --index-directory algolia-indexes/ \
158+ 2>&1 | tee algolia-update-index-log.txt
159+ fi
0 commit comments