File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -ex
3+
4+ sudo apt-get update
5+ sudo apt-get install -y wget curl
6+
7+ wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
8+ sudo dpkg -i packages-microsoft-prod.deb
9+ sudo apt-get update
10+ sudo apt-get install -y azcopy
11+ rm -f packages-microsoft-prod.deb
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -ex
4+
5+ wget https://github.com/mgdm/htmlq/releases/download/v0.4.0/htmlq-x86_64-linux.tar.gz
6+ tar -xzf htmlq-x86_64-linux.tar.gz
7+ sudo install htmlq /usr/bin/htmlq
8+ rm -f htmlq-x86_64-linux.tar.gz
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ API_KEY=$( az search admin-key show \
6+ --service-name platops-slack-help-bot-ptl \
7+ --resource-group slack-help-bot-cftptl-intsvc-rg \
8+ --subscription DTS-CFTPTL-INTSVC \
9+ --query primaryKey \
10+ -o tsv)
11+
12+ curl --fail-with-body \
13+ -X POST \
14+ -H " api-key: ${API_KEY} " \
15+ " https://platops-slack-help-bot-ptl.search.windows.net/indexers('ops-runbook')/search.run?api-version=2024-07-01" \
16+ -d ' '
17+
18+ echo " Index triggered"
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ rm -rf dist
6+ mkdir dist/
7+
8+ function extractMain () {
9+ local path=$1
10+
11+ DIRECTORY=$( dirname " $path " )
12+ mkdir -p dist/$DIRECTORY
13+
14+ cat $path | htmlq --text ' main' --remove-nodes ' [data-module="page-expiry"]' > dist/$path
15+ }
16+
17+ export -f extractMain
18+
19+ find build -name " *.html" -not -path " build/search/*" -exec bash -c " extractMain \" {}\" " \;
20+
21+ export STORAGE_ACCOUNT_NAME=platopslackhelpbotai
22+ export CONTAINER_NAME=ops-runbook
23+ export AZCOPY_AUTO_LOGIN_TYPE=AZCLI
24+ export AZCOPY_TENANT_ID=531ff96d-0ae9-462a-8d2d-bec7c0b42082
25+
26+ # we use sync here so that deleted files get removed
27+ azcopy sync --compare-hash=md5 \
28+ --delete-destination=true \
29+ --include-pattern=" *.html" \
30+ " dist/" " https://$STORAGE_ACCOUNT_NAME .blob.core.windows.net/$CONTAINER_NAME /"
31+
32+ function setTitle() {
33+ local path=$1
34+
35+ TITLE=$( cat ../$path | htmlq ' h1' --text)
36+
37+ echo " Setting title to $TITLE for $path "
38+
39+ az storage blob metadata update --auth-mode login --account-name $STORAGE_ACCOUNT_NAME --container-name $CONTAINER_NAME --name $path --metadata title=" $TITLE "
40+ }
41+
42+ export -f setTitle
43+
44+ pushd dist
45+ # another pass over to set the file title as a metadata attribute
46+ find . -name " *.html" -exec bash -c " setTitle \" {}\" " \;
47+
48+ popd
Original file line number Diff line number Diff line change 793793FLUSHALL
794794PDB
795795PDBs
796+ AZCLI
797+ azcopy
798+ platopslackhelpbotai
799+ popd
800+ pushd
796801XPOST
797802sitamp
798803sitamp01
Original file line number Diff line number Diff line change 4747 - name : Deploy to GitHub Pages
4848 id : deployment
4949 uses : actions/deploy-pages@v4
50+
51+ # For Azure AI Search used in hmcts/slack-help-bot
52+ - name : Azure login
53+ uses : azure/login@v3
54+ with :
55+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
56+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
57+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
58+ - name : Install dependencies
59+ run : |
60+ ./.ci/install-htmlq.sh
61+ ./.ci/install-azcopy.sh
62+ - name : Process content
63+ run : |
64+ ./.ci/upload.sh
65+ - name : Trigger index
66+ run : |
67+ ./.ci/trigger-index.sh
68+ # end of Azure AI Search
You can’t perform that action at this time.
0 commit comments