diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 23c5c80b56f..d0f6e8bd171 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -71,7 +71,7 @@ jobs: with: path: docs/demos/jupyter key: ${{ runner.os }}-jupyter-${{ hashFiles('docs/demos/jupyter/*') }} - + - name: Run Notebooks if: steps.jupyter-notebooks-cache.outputs.cache-hit != 'true' working-directory: docs/demos/jupyter @@ -90,11 +90,11 @@ jobs: aws-region: us-east-2 - name: Copy files to S3 with the AWS CLI - env: - DJL_VERSION: ${{ github.event.inputs.pt_version || 'master' }} + env: + DJL_VERSION: ${{ github.event.inputs.version-number || 'master' }} run: | - aws s3 sync $DJL_VERSION s3://djl-ai/documentation/nightly/$DJL_VERSION --delete - aws s3 cp versions.json s3://djl-ai/documentation/nightly/versions.json + aws s3 sync $DJL_VERSION s3://djl-ai/documentation/$DJL_VERSION --delete + aws s3 cp versions.json s3://djl-ai/documentation/versions.json aws cloudfront create-invalidation --distribution-id E733IIDCG0G5U --paths "/*" diff --git a/tools/scripts/build-website.sh b/tools/scripts/build-website.sh index d618d91203d..18b914a3d1e 100755 --- a/tools/scripts/build-website.sh +++ b/tools/scripts/build-website.sh @@ -2,31 +2,36 @@ set -ex +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" + VERSION_NUMBER=$1 if [[ "$VERSION_NUMBER" == "" ]]; then VERSION_NUMBER=master fi -BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - echo "Updating online runner ..." -python3 "$BASE_DIR/add_online_runner.py" +python3 "$REPO_ROOT/tools/scripts/add_online_runner.py" # Configure Git User, mike will create gh-pages branch -git config user.name "nobody" -git config user.email "nobody@localhost" - -echo "Building docs for $VERSION_NUMBER" -mike deploy "$VERSION_NUMBER" -F docs/mkdocs.yml -b gh-pages - -git checkout gh-pages +if [[ -z "$(git config user.name)" ]]; then + git config user.name "nobody" +fi +if [[ -z "$(git config user.email)" ]]; then + git config user.email "nobody@localhost" +fi echo "generating versions.json" -current_version=$(awk -F '=' '/djl / {gsub(/ ?"/, "", $2); print $2}' "$BASE_DIR/../../gradle/libs.versions.toml" | awk -F '.' '{print $2}') +current_version=$(awk -F '=' '/djl / {gsub(/ ?"/, "", $2); print $2}' "gradle/libs.versions.toml" | awk -F '.' '{print $2}') versions='[{"version":"master","title":"master","aliases":[]}' for i in {1..4}; do version="0.$((current_version - i)).0" - versions="$versions, {\"version\":\"$version\",\"title\":\"$version\",\"aliases\":[]}" + versions="$versions, {\"version\":\"v$version\",\"title\":\"v$version\",\"aliases\":[]}" done versions="$versions]" -echo "$versions" | jq "." > "$BASE_DIR/../../versions.json" + +echo "Building docs for $VERSION_NUMBER" +mike deploy "$VERSION_NUMBER" -F docs/mkdocs.yml -b gh-pages + +git checkout gh-pages + +echo "$versions" | jq "." >"$REPO_ROOT/versions.json"