-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from Holzhaus/netlify
Build on Travis and deploy to Netlify
- Loading branch information
Showing
5 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.7 |