diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..b0b240d8c9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +language: python +python: +- 3.7 +os: linux +dist: xenial +cache: + pip: true + +if: type != pull_request AND branch =~ /^(manual-)/ + +install: +- sudo apt-get update && sudo apt-get install -y texlive texlive-xetex texlive-latex-extra latexmk xindy +- npm install -g netlify-cli +- export PATH="$(npm prefix -g)/bin:$PATH" +- pip install -r requirements.txt + +script: +- mkdir html +- git remote rename origin fork +- git remote add origin https://github.com/mixxxdj/manual.git +- git fetch origin +- git branch -r +- export LATEST_BRANCH="$(git branch -r | grep -Po 'origin/manual-\d+\.\d+\.x' | sort | tail -n 1)" +- echo "Building from branch ${LATEST_BRANCH}" +- git checkout "${LATEST_BRANCH}" +- sh build_manual.sh + +deploy: + provider: script + skip_cleanup: true + script: netlify deploy --prod --dir build/html diff --git a/_redirects b/_redirects new file mode 100644 index 0000000000..1b48f753e0 --- /dev/null +++ b/_redirects @@ -0,0 +1,31 @@ +/ /latest/ 302 +/latest/* /2.2/:splat 301 +/:version/* /:version/ca/:splat 301 Language=ca +/:version/* /:version/cs/:splat 301 Language=cs +/:version/* /:version/de-DE/:splat 301 Language=de-DE +/:version/* /:version/de/:splat 301 Language=de +/:version/* /:version/en-GB/:splat 301 Language=en-GB +/:version/* /:version/es-ES/:splat 301 Language=es-ES +/:version/* /:version/es-MX/:splat 301 Language=es-MX +/:version/* /:version/es/:splat 301 Language=es +/:version/* /:version/fi/:splat 301 Language=fi +/:version/* /:version/fr/:splat 301 Language=fr +/:version/* /:version/gl/:splat 301 Language=gl +/:version/* /:version/id/:splat 301 Language=id +/:version/* /:version/it/:splat 301 Language=it +/:version/* /:version/ja-JP/:splat 301 Language=ja-JP +/:version/* /:version/kn/:splat 301 Language=kn +/:version/* /:version/nl/:splat 301 Language=nl +/:version/* /:version/pl/:splat 301 Language=pl +/:version/* /:version/pt-BR/:splat 301 Language=pt-BR +/:version/* /:version/pt/:splat 301 Language=pt +/:version/* /:version/ro/:splat 301 Language=ro +/:version/* /:version/ru-RU/:splat 301 Language=ru-RU +/:version/* /:version/ru/:splat 301 Language=ru +/:version/* /:version/sl/:splat 301 Language=sl +/:version/* /:version/sq/:splat 301 Language=sq +/:version/* /:version/sr/:splat 301 Language=sr +/:version/* /:version/tr/:splat 301 Language=tr +/:version/* /:version/zh-CN/:splat 301 Language=zh-CN +/:version/* /:version/zh-TW/:splat 301 Language=zh-TW +/:version/* /:version/en/:splat 301 diff --git a/build_manual.sh b/build_manual.sh new file mode 100755 index 0000000000..5eb267e314 --- /dev/null +++ b/build_manual.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Parse languages and ensure that "en" is built last +cd source || exit 1 +LANGUAGES="$(python -c 'import conf; print(" ".join(sorted((lang for lang in conf.supported_languages.keys() if lang != "en"), reverse=True)))')" +cd .. || exit 1 +LANGUAGES="$LANGUAGES en" +NUM_LANGUAGES="$(printf '%s' "$LANGUAGES" | wc -w)" + +# Write _redirects file +mkdir -p build/html +printf '/ /latest/ 302\n' > build/html/_redirects +printf '/latest/* /2.2/:splat 301\n' >> build/html/_redirects + +i=1 +for lang in $LANGUAGES +do + printf -- '----- Building language "%s"... [%d/%d] -----\n' "$lang" "$i" "$NUM_LANGUAGES" + + if [ "$lang" = "en" ] + then + printf '/:version/* /:version/en/:splat 301\n' >> build/html/_redirects + else + printf '/:version/* /:version/%s/:splat 301 Language=%s\n' "$lang" "$lang" >> build/html/_redirects + fi + make versionedhtml SPHINXOPTS="-Q -j $(nproc) -Dlanguage=$lang" + make versionedlatexpdf SPHINXOPTS="-Q -j $(nproc) -Dlanguage=$lang" >/dev/null + i=$((i + 1)) +done + +cd build/latex || exit 1 +for file in */*/Mixxx-Manual.pdf +do + cp "$file" "../html/$file" +done diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000000..a3f010f9ef --- /dev/null +++ b/netlify.toml @@ -0,0 +1,20 @@ +# Settings in the [build] context are global and are applied to all contexts +# unless otherwise overridden by more specific contexts. +[build] + # Directory to change to before starting a build. + # This is where we will look for package.json/.nvmrc/etc. + base = "" + + # Default build command. + command = "sphinx-build -b html source build" + + # Directory (relative to root of your repo) that contains the deploy-ready + # HTML files and assets generated by the build. If a base directory has + # been specified, include it in the publish directory path. + publish = "build" + +[context.production] + # Production content is pushed to master + # Exit code 0 means that this build will be ignored + # https://docs.netlify.com/configure-builds/file-based-configuration/#ignore-builds + ignore = "true" diff --git a/runtime.txt b/runtime.txt new file mode 100644 index 0000000000..548d71365f --- /dev/null +++ b/runtime.txt @@ -0,0 +1 @@ +3.7 \ No newline at end of file