Skip to content

Commit

Permalink
build: update release script [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-zeng committed Apr 8, 2018
1 parent cbaec5b commit e8ee31a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 45 deletions.
98 changes: 53 additions & 45 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,62 +1,70 @@
#!/usr/bin/env sh

export NAME=zhlipsum
# This script is used for creating CTAN archive of zhlipsum.

export TEX_PATH=TDS/tex/latex/$NAME
export DOC_PATH=TDS/doc/latex/$NAME
export SRC_PATH=TDS/source/latex/$NAME
export TEMP_PATH=TDS/TEMP
JOB_NAME=zhlipsum
WORKING_DIR=$PWD

export DOC_EN_SCRIPT=scripts/get-doc-en.lua
export ZHCONVERT_SCRIPT=scripts/zhconvert.local.sh
# Copy all the files to system temp folder, in order to use
# chmod correctly.
TEMP_DIR=/tmp/$JOB_NAME

# Make TDS zip
TDS_DIR=$TEMP_DIR/TDS
CTAN_DIR=$TEMP_DIR/$JOB_NAME

mkdir -p $SRC_PATH/
mkdir -p $TEX_PATH/
mkdir -p $DOC_PATH/
mkdir -p $TEMP_PATH/
SRC_DIR=$TDS_DIR/source/latex/$JOB_NAME
TEX_DIR=$TDS_DIR/tex/latex/$JOB_NAME
DOC_DIR=$TDS_DIR/doc/latex/$JOB_NAME

cp source/*.dtx $TEMP_PATH/
cp source/*.pdf $TEMP_PATH/
DOC_EN_SCRIPT=$WORKING_DIR/scripts/get-doc-en.lua
ZHCONVERT_SCRIPT=$WORKING_DIR/scripts/zhconvert.sh

# All files should be rw-rw-r--
chmod 664 $TEMP_PATH/*
mkdir -p $TEMP_DIR

cd $TEMP_PATH/
xetex $NAME.dtx
texlua ../../$DOC_EN_SCRIPT $NAME.dtx $NAME-en.tex
source ../../$ZHCONVERT_SCRIPT
cd ../..
mkdir -p $TDS_DIR
mkdir -p $CTAN_DIR

mv $TEMP_PATH/*.dtx $SRC_PATH/
mv $TEMP_PATH/*.ins $SRC_PATH/
mv $TEMP_PATH/*.sty $TEX_PATH/
mv $TEMP_PATH/*.def $TEX_PATH/
mv $TEMP_PATH/*.md $DOC_PATH/
mv $TEMP_PATH/*.tex $DOC_PATH/
mv $TEMP_PATH/*.pdf $DOC_PATH/
mkdir -p $SRC_DIR
mkdir -p $TEX_DIR
mkdir -p $DOC_DIR

cd TDS/
rm -r TEMP/
cp $WORKING_DIR/source/*.dtx $TEMP_DIR
cp $WORKING_DIR/source/*.pdf $TEMP_DIR

zip -r -9 $NAME.tds.zip .
cd ..
mv -f TDS/$NAME.tds.zip .
cd $TEMP_DIR
xetex $JOB_NAME.dtx >/dev/null
texlua $DOC_EN_SCRIPT $JOB_NAME.dtx $JOB_NAME-en.tex
$ZHCONVERT_SCRIPT

# Make CTAN zip
# All files should be rw-r--r--
chmod 644 $TEMP_DIR/*.*

mkdir CTAN/
cp $TEMP_DIR/*.dtx $SRC_DIR
cp $TEMP_DIR/*.ins $SRC_DIR
cp $TEMP_DIR/*.def $TEX_DIR
cp $TEMP_DIR/*.sty $TEX_DIR
cp $TEMP_DIR/*.md $DOC_DIR
cp $TEMP_DIR/*.tex $DOC_DIR
cp $TEMP_DIR/*.pdf $DOC_DIR

# Make TDS zip
cd $TDS_DIR
zip -q -r -9 $JOB_NAME.tds.zip .

cp $SRC_PATH/*.dtx CTAN/
cp $DOC_PATH/*.md CTAN/
cp $DOC_PATH/*.pdf CTAN/
cp $NAME.tds.zip CTAN/
cp $TEMP_DIR/*.dtx $CTAN_DIR
cp $TEMP_DIR/*.md $CTAN_DIR
cp $TEMP_DIR/*.pdf $CTAN_DIR
cp $TDS_DIR/*.zip $CTAN_DIR

rm -r $TDS_DIR
rm $TEMP_DIR/*.*

# Make CTAN zip
cd $TEMP_DIR
zip -q -r -9 $JOB_NAME.zip .

cd CTAN/
zip -r -9 $NAME.zip .
cd ..
mv -f CTAN/$NAME.zip .
cd $WORKING_DIR
cp -f $TEMP_DIR/$JOB_NAME.zip .
cp -f $CTAN_DIR/$JOB_NAME.tds.zip .

rm -r TDS/
rm -r CTAN/
rm -r $TEMP_DIR
13 changes: 13 additions & 0 deletions scripts/zhconvert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env sh

# This script is used for converting encoding from UTF-8 to GBK/Big5.

JOB_NAME=zhlipsum

mv $JOB_NAME-gbk.def $JOB_NAME-gbk.tmp.def
mv $JOB_NAME-big5.def $JOB_NAME-big5.tmp.def

iconv -f utf8 -t gbk -o $JOB_NAME-gbk.def $JOB_NAME-gbk.tmp.def
iconv -f utf8 -t big5 -o $JOB_NAME-big5.def $JOB_NAME-big5.tmp.def

rm *.tmp.def

0 comments on commit e8ee31a

Please sign in to comment.