From 6aeca286c5179b6620f46cddef37d02f27d4dcb3 Mon Sep 17 00:00:00 2001 From: Filip Czaplicki Date: Thu, 8 Feb 2024 20:47:01 +0100 Subject: [PATCH] Actually build for every language LANG_PLACEHOLDER hack was fast but well... hack For dev main build is copied faster --- .github/workflows/deploy_development.yml | 12 +++++++++++- scripts/build_every_lang.sh | 8 ++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy_development.yml b/.github/workflows/deploy_development.yml index 9359130..b5b8713 100644 --- a/.github/workflows/deploy_development.yml +++ b/.github/workflows/deploy_development.yml @@ -54,6 +54,16 @@ jobs: User-agent: * Disallow: / EOF - - name: Run deploy script on host + - name: Copy main build to server + run: | + rsync -rp -e 'ssh -p ${{ secrets.SSH_HOST_NEW_PORT }}' build/* ${{ secrets.SSH_USER_NEW }}@${{ secrets.SSH_HOST_NEW_IP }}:~/dev-static/ + - name: Build app lang versions + env: + VITE_ENV: development + VITE_OSM_API_URL: 'https://master.apis.dev.openstreetmap.org' + VITE_OSM_OAUTH2_CLIENT_ID: ${{ secrets.REACT_APP_OSM_OAUTH2_CLIENT_ID }} + VITE_BACKEND_API_URL: 'https://dev.openaedmap.org' + run: ./scripts/build_every_lang.sh + - name: Copy lang version builds to server run: | rsync -rp --delete -e 'ssh -p ${{ secrets.SSH_HOST_NEW_PORT }}' build/* ${{ secrets.SSH_USER_NEW }}@${{ secrets.SSH_HOST_NEW_IP }}:~/dev-static/ \ No newline at end of file diff --git a/scripts/build_every_lang.sh b/scripts/build_every_lang.sh index c4a4f83..f458003 100755 --- a/scripts/build_every_lang.sh +++ b/scripts/build_every_lang.sh @@ -1,16 +1,12 @@ #!/usr/bin/env bash set -eu -LANG_PLACEHOLDER=LANG_PLACEHOLDER -VITE_DEFAULT_LANG=$LANG_PLACEHOLDER -npm run build -- --outDir build/$VITE_DEFAULT_LANG --base "/$VITE_DEFAULT_LANG" for lang in public/locales/*; do lang=$(basename "$lang") if [[ $lang = "debug" ]]; then continue fi + export VITE_DEFAULT_LANG=$lang echo "Generating $lang" - cp -r "build/$LANG_PLACEHOLDER" "build/$lang" - sed -i -- "s/$LANG_PLACEHOLDER/$lang/g" "build/$lang/index.html" "build/$lang/assets"/* + npm run build -- --outDir "build/$lang" --base "/$lang" done -rm -rf "build/$LANG_PLACEHOLDER"