Skip to content

Commit 19dd3d8

Browse files
committed
Revert "Update for docs-build branch"
This reverts commit cd628fe.
1 parent 1aaffb2 commit 19dd3d8

File tree

6 files changed

+110
-22
lines changed

6 files changed

+110
-22
lines changed

.github/actions/algolia-config.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"index_name": "session-docs",
3+
"start_urls": [
4+
"https://docs.spring.io/spring-session/reference/"
5+
],
6+
"selectors": {
7+
"lvl0": {
8+
"selector": "//nav[@class='crumbs']//li[@class='crumb'][last()-1]",
9+
"type": "xpath",
10+
"global": true,
11+
"default_value": "Home"
12+
},
13+
"lvl1": ".doc h1",
14+
"lvl2": ".doc h2",
15+
"lvl3": ".doc h3",
16+
"lvl4": ".doc h4",
17+
"text": ".doc p, .doc td.content, .doc th.tableblock"
18+
}
19+
}
20+

.github/actions/algolia-deploy.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
HOST="$1"
4+
HOST_PATH="$2"
5+
SSH_PRIVATE_KEY="$3"
6+
SSH_KNOWN_HOST="$4"
7+
8+
9+
if [ "$#" -ne 4 ]; then
10+
echo -e "not enough arguments USAGE:\n\n$0 \$HOST \$HOST_PATH \$SSH_PRIVATE_KEY \$SSH_KNOWN_HOSTS \n\n" >&2
11+
exit 1
12+
fi
13+
14+
# Use a non-default path to avoid overriding when testing locally
15+
SSH_PRIVATE_KEY_PATH=~/.ssh/github-actions-docs
16+
install -m 600 -D /dev/null "$SSH_PRIVATE_KEY_PATH"
17+
echo "$SSH_PRIVATE_KEY" > "$SSH_PRIVATE_KEY_PATH"
18+
echo "$SSH_KNOWN_HOST" > ~/.ssh/known_hosts
19+
rsync --delete -avze "ssh -i $SSH_PRIVATE_KEY_PATH" spring-session-docs/build/site/ "$HOST:$HOST_PATH"
20+
rm -f "$SSH_PRIVATE_KEY_PATH"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
###
4+
# Docs
5+
# config.json https://docsearch.algolia.com/docs/config-file
6+
# Run the crawler https://docsearch.algolia.com/docs/run-your-own/#run-the-crawl-from-the-docker-image
7+
8+
### USAGE
9+
if [ "$#" -ne 3 ]; then
10+
echo -e "not enough arguments USAGE:\n\n$0 \$ALGOLIA_APPLICATION_ID \$ALGOLIA_API_KEY \$CONFIG_FILE\n\n" >&2
11+
exit 1
12+
fi
13+
14+
# Script Parameters
15+
APPLICATION_ID=$1
16+
API_KEY=$2
17+
CONFIG_FILE=$3
18+
19+
#### Script
20+
script_dir=$(dirname $0)
21+
docker run -e "APPLICATION_ID=$APPLICATION_ID" -e "API_KEY=$API_KEY" -e "CONFIG=$(cat $CONFIG_FILE | jq -r tostring)" algolia/docsearch-scraper

.github/workflows/algolia-index.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Update Algolia Index
2+
3+
on:
4+
schedule:
5+
- cron: '0 10 * * *' # Once per day at 10am UTC
6+
workflow_dispatch: # Manual trigger
7+
8+
jobs:
9+
update:
10+
name: Update Algolia Index
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Source
14+
uses: actions/checkout@v2
15+
- name: Update Index
16+
run: ${GITHUB_WORKSPACE}/.github/actions/algolia-docsearch-scraper.sh "${{ secrets.ALGOLIA_APPLICATION_ID }}" "${{ secrets.ALGOLIA_WRITE_API_KEY }}" "${GITHUB_WORKSPACE}/.github/actions/algolia-config.json"

.github/workflows/deploy-docs.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build & Deploy Reference
2+
3+
on:
4+
repository_dispatch:
5+
types: request-build-reference
6+
schedule:
7+
- cron: '0 10 * * *' # Once per day at 10am UTC
8+
workflow_dispatch: # Manual trigger
9+
10+
jobs:
11+
deploy:
12+
name: deploy
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v2
18+
with:
19+
java-version: '17'
20+
distribution: 'adopt'
21+
cache: gradle
22+
- name: Validate Gradle wrapper
23+
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
24+
- name: Build with Gradle
25+
run: ./gradlew :spring-session-docs:antora --stacktrace
26+
- name: Cleanup Gradle Cache
27+
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
28+
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
29+
run: |
30+
rm -f ~/.gradle/caches/modules-2/modules-2.lock
31+
rm -f ~/.gradle/caches/modules-2/gc.properties
32+
- name: Deploy
33+
run: ${GITHUB_WORKSPACE}/.github/actions/algolia-deploy.sh "${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}" "/opt/www/domains/spring.io/docs/htdocs/spring-session/reference/" "${{ secrets.DOCS_SSH_KEY }}" "${{ secrets.DOCS_SSH_HOST_KEY }}"

0 commit comments

Comments
 (0)