Skip to content

Commit

Permalink
Actually build for every language
Browse files Browse the repository at this point in the history
LANG_PLACEHOLDER hack was fast but well... hack
For dev main build is copied faster
  • Loading branch information
starsep committed Feb 8, 2024
1 parent 2c1b4f6 commit 6aeca28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/deploy_development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
8 changes: 2 additions & 6 deletions scripts/build_every_lang.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 6aeca28

Please sign in to comment.