updated Attraction Golem's name #1239
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Delta repository generator - SQLite variant | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
commit: | |
runs-on: ubuntu-latest | |
env: | |
REMOTE: ProjectIgnis/DeltaPuppetOfStrings.git | |
DESTINATION: DeltaPuppetOfStrings | |
BASE_SHA: 20220912 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install sqlite3 | |
run: | | |
sudo apt update | |
sudo apt install -y sqlite3 | |
- name: Clone destination repository | |
run: | | |
cd $HOME | |
git clone https://${{ secrets.DEPLOY_TOKEN }}@github.com/$REMOTE | |
mkdir -p $DESTINATION | |
- name: Copy new CDBs only | |
run: | | |
ADDED=$(git diff --name-only --no-renames --diff-filter=A $BASE_SHA | grep ".cdb$" || [[ $? == 1 ]]) | |
if [[ "$ADDED" ]]; then | |
rsync -avR $ADDED $HOME/$DESTINATION | |
fi | |
- name: Remove deleted files | |
run: | | |
if [[ -f $HOME/$DESTINATION/VERSION ]]; then | |
LAST_SHA=$(cat $HOME/$DESTINATION/VERSION) | |
REMOVED=$(git diff --name-only --no-renames --diff-filter=D $LAST_SHA) | |
if [[ "$REMOVED" ]]; then | |
cd $HOME/$DESTINATION | |
git rm -rf --ignore-unmatch $REMOVED | |
fi | |
fi | |
- name: Generate SQLite deltas | |
run: | | |
CHANGED=$(git diff --name-only --diff-filter=M $BASE_SHA | grep ".cdb$" || [[ $? == 1 ]]) | |
for DB in $CHANGED; do | |
./ci/sqlite3-git.sh $BASE_SHA $DB | |
done | |
find . -type f -name '*.delta.cdb' -exec rsync -avR {} $HOME/$DESTINATION \; | |
- name: Commit and push with original metadata | |
run: | | |
MESSAGE=$(git log -1 --pretty=%B) | |
AUTHOR=$(git log -1 --pretty=format:'%an') | |
EMAIL=$(git log -1 --pretty=format:'%ae') | |
COMMITTER=$(git log -1 --pretty=format'%cn') | |
CEMAIL=$(git log -1 --pretty=format:'%ce') | |
cd $HOME/$DESTINATION | |
git config user.email "$CEMAIL" | |
git config user.name "$COMMITTER" | |
git add -A . | |
if [[ $(git status --porcelain) ]]; then | |
echo $GITHUB_SHA > VERSION | |
git add -A . | |
git commit --author="$AUTHOR <$EMAIL>" -m "$MESSAGE" | |
git push | |
fi |