scripts: don't build archives when pages haven't been changed (#11825)
* scripts/build.sh: don't build archives when pages haven't been changed * scripts: don't build the index when pages haven't been changed, fix deploy.sh * feat: check for changes before committing in deploy.sh * cleanup: update scripts/deploy.sh Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> --------- Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
This commit is contained in:
@@ -30,21 +30,26 @@ function initialize {
|
||||
|
||||
function upload_assets {
|
||||
git clone --quiet --depth 1 git@github.com:${SITE_REPO_SLUG}.git "$SITE_HOME"
|
||||
mv -f "$TLDR_ARCHIVE" "$SITE_HOME/assets/"
|
||||
[[ -f "$TLDR_ARCHIVE" ]] && mv -f "$TLDR_ARCHIVE" "$SITE_HOME/assets/"
|
||||
find "$TLDR_LANG_ARCHIVES_DIRECTORY" -maxdepth 1 -name "*.zip" -exec mv -f {} "$SITE_HOME/assets/" \;
|
||||
rm -rf "$TLDR_LANG_ARCHIVES_DIRECTORY"
|
||||
cp -f "$TLDRHOME/index.json" "$SITE_HOME/assets/"
|
||||
[[ -f "$TLDRHOME/index.json" ]] && cp -f "$TLDRHOME/index.json" "$SITE_HOME/assets/"
|
||||
find "$TLDR_PDF_FILES_DIRECTORY" -maxdepth 1 -name "*.pdf" -exec mv -f {} "$SITE_HOME/assets/" \;
|
||||
rm -rf "$TLDR_PDF_FILES_DIRECTORY"
|
||||
|
||||
cd "$SITE_HOME/assets"
|
||||
sha256sum -- index.json *.zip > tldr.sha256sums
|
||||
|
||||
# Check if there are changes before committing and pushing.
|
||||
if git diff --quiet; then
|
||||
echo "No changes to deploy."
|
||||
return
|
||||
fi
|
||||
|
||||
git add -A
|
||||
git commit -m "[GitHub Actions] uploaded assets after commit tldr-pages/tldr@${GITHUB_SHA}"
|
||||
git push -q
|
||||
|
||||
echo "Assets (pages archive, index) deployed to static site."
|
||||
echo "Assets (pages archive, index and checksum) deployed to the static site."
|
||||
}
|
||||
|
||||
###################################
|
||||
|
Reference in New Issue
Block a user