Added .yml files and changed folders #6
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: public_html update | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- public_html/** | |
workflow_dispatch: | |
inputs: | |
manual: | |
description: Manually updates the public_html! | |
jobs: | |
build: | |
name: public_html Updater | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: Copy files | |
run: | | |
mkdir -p /home/runner/work/obhqWebsite/temp/public_html/ | |
cp -r /home/runner/work/obhqWebsite/obhqWebsite/public_html/* /home/runner/work/obhqWebsite/temp/public_html/ | |
- name: Commit and push changes to gh-pages | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git fetch origin gh-pages | |
git switch gh-pages --force | |
mv /home/runner/work/obhqWebsite/temp/public_html/* /home/runner/work/obhqWebsite/obhqWebsite/ | |
touch /home/runner/work/obhqWebsite/obhqWebsite/.nojekyll | |
git add /home/runner/work/obhqWebsite/obhqWebsite/ -f | |
files_to_commit=$(git status --porcelain | grep -E 'M|A|D' | wc -l) | |
if [ $files_to_commit -gt 0 ]; then | |
echo "Committing changes!" | |
git fetch origin gh-pages | |
git commit -m "public_html update" | |
git push origin gh-pages | |
else | |
echo "No changes to commit." | |
fi |