-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patharchive.sh
More file actions
executable file
·35 lines (27 loc) · 923 Bytes
/
archive.sh
File metadata and controls
executable file
·35 lines (27 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -euo pipefail
# Keep the commit hash
touch translations_github_commit_${GITHUB_SHA}
# Selecting only a file doesn't seem to work, using a dir instead
mkdir -p to_upload
# Recursive top-down renamer: replace '-' with '_' in directory names
rename_dirs() {
local dir="$1"
# Rename current directory if needed
local newdir="${dir//-/_}"
if [[ "$newdir" != "$dir" ]]; then
echo "Renaming: '$dir' -> '$newdir'"
mv "$dir" "$newdir" || return 1
dir="$newdir"
fi
# Recurse into subdirectories
for subdir in "$dir"/*/; do
[[ -d "$subdir" ]] || continue
rename_dirs "${subdir%/}"
done
}
rename_dirs "foundation/translations"
echo "Archiving files"
tar -C foundation/translations -cvf ./to_upload/translations.tar ./locale ./legacy_apps
tar rvf ./to_upload/translations.tar ./translations_github_commit_${GITHUB_SHA}
echo "Done!"