sync-vip #3778
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
on: | |
# Uncomment this to also run on every push to main. | |
# push: | |
# branches: | |
# - main | |
schedule: | |
- cron: '15 6 * * 0' # Run once per week at 6:15am UTC on Sundays. | |
name: sync-vip | |
jobs: | |
sync-theme: | |
name: sync vip | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup vip branch | |
shell: bash | |
env: | |
TOKEN: ${{ secrets.PERSONAL_TOKEN }} | |
THEME: twentytwentyone | |
run: | | |
git config --global user.name "$GITHUB_ACTOR" | |
git config --global user.email "[email protected]" | |
echo "Cloning create-mantle-app..." | |
git clone --depth=1 https://[email protected]/alleyinteractive/create-mantle-app.git create-mantle-app | |
echo "Cloning wordpress..." | |
git clone --depth=1 https://github.com/WordPress/WordPress.git wordpress | |
cd create-mantle-app | |
set +e | |
echo "Updating vip..." | |
git checkout -b vip | |
git ls-files -i --exclude-from=.gitignore | xargs git rm --cached | |
echo "Moving to client-mu-plugins..." | |
mv mu-plugins client-mu-plugins | |
# Manually replace some files that VIP has | |
rm -rf README.md | |
mv .gitignore .. | |
echo "Fetching vip..." | |
git remote add vip https://github.com/Automattic/vip-go-skeleton.git | |
git fetch vip | |
echo "Merging in vip..." | |
echo $(git merge vip/master --no-edit --allow-unrelated-histories --strategy-option theirs || true) | |
set -e | |
echo "Replacing theme..." | |
rm -rf themes/$THEME | |
rm -rf themes/twenty* | |
mv ../wordpress/wp-content/themes/$THEME themes/$THEME | |
# Merge gitignore | |
cat ../.gitignore >> .gitignore | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "No changes" | |
else | |
echo "Committing..." | |
git add -A | |
git commit -m "Syncing from vip-go-skeleton" | |
git push --force -u origin vip | |
fi |