Skip to content

Commit

Permalink
Beta mode; organize code
Browse files Browse the repository at this point in the history
Use modern syntax $(…) in place of `…`.

Quote $MODE in comparison to avoid the confusing “unary operator expected” error when value is empty in testing.

Copy directories directly (rather copy content of a directory to a ready-made directory) whenever possible, for simpler code.
  • Loading branch information
lianghai committed Dec 5, 2024
1 parent 273655e commit 55166cd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 112 deletions.
48 changes: 29 additions & 19 deletions .github/workflows/publish-ucd.sh
Original file line number Diff line number Diff line change
@@ -1,46 +1,56 @@
# See publish-ucd.yml

TODAY=`date --iso-8601`

mkdir dist

PUB_DATE=$(date --iso-8601)

cat > dist/sed-readmes.txt << eof
s/COPY_YEAR/$COPY_YEAR/
s/PUB_DATE/$TODAY/
s/PUB_DATE/$PUB_DATE/
s/PUB_STATUS/draft/
s/UNI_VER/$UNI_VER/
s/EMOJI_VER/$EMOJI_VER/
s/TR10_REV/$TR10_REV/
s%PUBLIC_EMOJI%Public/draft/emoji%
s%PUBLIC_UCD%Public/draft/UCD%
eof

mkdir -p dist/UCD/ucd
mkdir dist/zipped
cp -r unicodetools/data/ucd/dev/* dist/UCD/ucd
rm -r dist/UCD/ucd/Unihan
mkdir dist/UCD
cp -R unicodetools/data/ucd/dev dist/UCD/ucd
mv dist/UCD/ucd/version-ReadMe.txt dist/UCD/ReadMe.txt
mv dist/UCD/ucd/zipped-ReadMe.txt dist/zipped/ReadMe.txt
rm -r dist/UCD/ucd/Unihan
if [ "$MODE" = "Snapshot" ]; then
rm -r dist/UCD/ucd/emoji
fi

if [ $MODE = "Alpha" ]; then
mkdir dist/emoji
cp unicodetools/data/emoji/dev/* dist/emoji
if [ "$MODE" = "Alpha" ] || [ "$MODE" = "Beta" ]; then
cp -R unicodetools/data/emoji/dev dist/emoji

mkdir dist/idna
cp unicodetools/data/idna/dev/* dist/idna
cp -R unicodetools/data/idna/dev dist/idna

mkdir dist/idna2008derived
cp unicodetools/data/idna/idna2008derived/Idna2008-$UNI_VER.txt dist/idna2008derived
cp unicodetools/data/idna/idna2008derived/ReadMe.txt dist/idna2008derived
else
rm -r dist/UCD/ucd/emoji
cp unicodetools/data/idna/idna2008derived/Idna2008-$UNI_VER.txt dist/idna2008derived

if [ "$MODE" = "Beta" ]; then
cp -R unicodetools/data/uca/dev dist/UCA
sed -i -f dist/sed-readmes.txt dist/UCA/CollationTest.html

cp -R unicodetools/data/security/dev dist/security
fi
fi

# Update the readmes in-place (-i) as set up above.
find dist -name '*ReadMe.txt' | xargs sed -i -f dist/sed-readmes.txt
rm dist/sed-readmes.txt

# Zip files for some types of data, after fixing permissions
mkdir dist/zipped
mv dist/UCD/ucd/zipped-ReadMe.txt dist/zipped/ReadMe.txt
(cd dist/UCD/ucd; zip -r UCD.zip *)
mv dist/UCD/ucd/UCD.zip dist/zipped

# Cleanup
rm dist/sed-readmes.txt
if [ "$MODE" = "Beta" ]; then
(cd dist/UCA; zip -r CollationTest.zip CollationTest; rm -r CollationTest)

(cd dist/security; zip -r uts39-data-$UNI_VER.zip *)
fi
2 changes: 2 additions & 0 deletions .github/workflows/publish-ucd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ on:
options:
- Snapshot
- Alpha
- Beta
default: Snapshot

env:
COPY_YEAR: "2024"
UNI_VER: "17.0.0"
EMOJI_VER: "17.0"
TR10_REV: "tr10-52" # UTS #10 release revision number to be used in CollationTest.html: One more than the last release revision number.
MODE: ${{ inputs.mode }}

jobs:
Expand Down
93 changes: 0 additions & 93 deletions pub/copy-beta-to-draft.sh

This file was deleted.

0 comments on commit 55166cd

Please sign in to comment.