SOFA/.github/workflows/sync_repo.sh

30 lines
1.0 KiB
Bash
Raw Normal View History

2020-12-04 12:46:30 -06:00
#!/bin/bash
# This script runs after the prechecks and before the deployment
# In the host enviroment (All the GITHUB variables are available)
2020-12-04 01:18:22 -06:00
2020-12-04 12:46:30 -06:00
# Working directory in github workspace
# Original repo is places SOFA-Chips
# for conditional file copy use PROJ_SUFFIX (example SOFA_HD)
2020-12-14 16:29:41 -06:00
COPY_FILE="./SOFA-Chips/SynRepoConfig/sync_files_${PROJ_SUFFIX,,}.csv"
echo "[Info] Using file for rsync $COPY_FILE"
tail -n +2 $COPY_FILE | while IFS=, read -r srcLoc dstLoc; do
srcLoc=$(echo $(eval "echo $srcLoc"))
dstLoc=$(echo $(eval "echo $dstLoc"))
echo "Copying ./SOFA-Chips/$srcLoc --> ${DEST_DIR}/$dstLoc"
rsync -ap ./SOFA-Chips/$srcLoc ${DEST_DIR}/$dstLoc
2020-12-04 12:46:30 -06:00
done
2020-12-04 01:18:22 -06:00
2020-12-04 12:46:30 -06:00
cd ${DEST_DIR}
2020-12-04 01:18:22 -06:00
2020-12-17 16:01:49 -06:00
[ -s source_commit_hash.txt ] || echo "---- Start ----" > source_commit_hash.txt
2020-12-08 12:31:04 -06:00
2020-12-17 16:01:49 -06:00
sed -i "1i GITHUB_SHA ${GITHUB_SHA:--}" source_commit_hash.txt
sed -i "1i Date $(date)" source_commit_hash.txt
sed -i '1i = = = = = = = = = = = = = = = =' source_commit_hash.txt
2020-12-08 12:31:04 -06:00
# Clean up file from repo
2020-12-17 16:01:49 -06:00
git checkout master qflow
rm -rf .travis*
rm -f .travis.yml
find . -xtype l -delete