From e72869fc8bb1a85891cede8dbe6281f458ffa226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lorber?= Date: Wed, 13 Jan 2021 18:29:41 +0100 Subject: [PATCH] chore(v1): upgrade v1 Crowdin cli + CI config (#4040) * Upgrade Crowdin cli for v1 site: cli v2->v3 + simplify install through npm instead of .deb * add netlify.toml in v1 site * trigger ci * netlify * netlify * netlify --- .circleci/config.yml | 28 ++++++++++++++-------------- crowdin.yaml => crowdin-v1.yml | 23 +++-------------------- website-1.x/netlify.toml | 10 ++++++++++ website-1.x/package.json | 6 ++++-- 4 files changed, 31 insertions(+), 36 deletions(-) rename crowdin.yaml => crowdin-v1.yml (65%) create mode 100644 website-1.x/netlify.toml diff --git a/.circleci/config.yml b/.circleci/config.yml index 94b29e9786..987f4b8674 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -81,22 +81,22 @@ jobs: if ! git diff-tree --no-commit-id --name-only -r HEAD | grep -E "(^docs\/.*)|(docusaurus-1\.x\/.*)|(website-1\.x\/.*)"; then echo "Skipping deploy. No relevant v1 website files have changed" elif [[ $CIRCLE_PROJECT_USERNAME == "facebook" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then - echo "Deploying website..." + echo "Deploying website v1..." + cd website-1.x + # install Docusaurus and generate file of English strings - cd website-1.x && yarn run write-translations - # install Crowdin - sudo apt-get update - sudo apt-get install default-jre rsync - wget https://artifacts.crowdin.com/repo/deb/crowdin.deb -O crowdin.deb - sudo dpkg -i crowdin.deb - sleep 5 + yarn run write-translations + # upload translation strings and download translations - yarn run crowdin-upload + yarn crowdin-upload + # download only enabled languages - for lang in fr ko ru ro pt-BR zh-CN - do - yarn crowdin-download -l $lang - done + yarn crowdin-download + # for lang in fr ko ru ro pt-BR zh-CN + # do + # yarn crowdin-download -l $lang + # done + # publish GIT_USER=docusaurus-bot USE_SSH=false yarn run publish-gh-pages else @@ -119,4 +119,4 @@ workflows: - deploy-website: requires: - tests - filters: *filter-only-master \ No newline at end of file + filters: *filter-only-master diff --git a/crowdin.yaml b/crowdin-v1.yml similarity index 65% rename from crowdin.yaml rename to crowdin-v1.yml index d9cf38c810..510a920137 100644 --- a/crowdin.yaml +++ b/crowdin-v1.yml @@ -1,6 +1,6 @@ -project_identifier_env: CROWDIN_DOCUSAURUS_PROJECT_ID -api_key_env: CROWDIN_DOCUSAURUS_API_KEY -base_path: "./" +project_id: '290988' +api_token_env: 'CROWDIN_PERSONAL_TOKEN' +base_path: "." preserve_hierarchy: true files: @@ -9,30 +9,13 @@ files: translation: '/website-1.x/translated_docs/%locale%/**/%original_file_name%' languages_mapping: &anchor locale: - 'af': 'af' - 'ar': 'ar' - 'bs-BA': 'bs-BA' - 'ca': 'ca' - 'cs': 'cs' - 'da': 'da' - 'de': 'de' - 'el': 'el' 'es-ES': 'es-ES' - 'fa': 'fa-IR' - 'fi': 'fi' 'fr': 'fr' - 'he': 'he' - 'hu': 'hu' - 'id': 'id-ID' 'it': 'it' 'ja': 'ja' 'ko': 'ko' - 'mr': 'mr-IN' 'nl': 'nl' - 'no': 'no-NO' - 'pl': 'pl' 'pt-BR': 'pt-BR' - 'pt-PT': 'pt-PT' 'ro': 'ro' 'ru': 'ru' 'sk': 'sk-SK' diff --git a/website-1.x/netlify.toml b/website-1.x/netlify.toml new file mode 100644 index 0000000000..5162b2c68f --- /dev/null +++ b/website-1.x/netlify.toml @@ -0,0 +1,10 @@ + +# Note: this file's config override the Netlify UI admin config + +[build] + base = "/" + command = "yarn workspace docusaurus-1-website netlify:build" + publish = "website-1.x/build/docusaurus" + +[context.production] + command = "yarn workspace docusaurus-1-website netlify:build:production" diff --git a/website-1.x/package.json b/website-1.x/package.json index 7340ef0351..4749764e36 100644 --- a/website-1.x/package.json +++ b/website-1.x/package.json @@ -10,8 +10,10 @@ "write-translations": "docusaurus-write-translations", "docusaurus-version": "docusaurus-version", "rename-version": "docusaurus-rename-version", - "crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master", - "crowdin-download": "crowdin --config ../crowdin.yaml download -b master" + "crowdin-upload": "cd .. && crowdin upload sources --auto-update -b master --config crowdin-v1.yml", + "crowdin-download": "cd .. && crowdin download -b master --config crowdin-v1.yml", + "netlify:build": "yarn build", + "netlify:build:production": "yarn crowdin download && yarn build" }, "dependencies": { "docusaurus": "2.0.0-alpha.70"