Update Site #683
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: Update Site | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 30 2 * * * | |
jobs: | |
auto-scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Pull Feeds | |
run: | | |
cd _includes | |
rm -rf feed.xml atom.xml feed.json | |
wget https://hpc.social/personal-blog/feed.xml | |
wget https://hpc.social/personal-blog/atom.xml | |
wget https://hpc.social/personal-blog/feed.json | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Build site | |
run: | | |
bundle install | |
bundle exec jekyll build | |
- name: Deploy | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -xo pipefail | |
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
git branch | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git status | |
rm -rf _site | |
rm -rf .jekyll-cache | |
git add ./_includes/* | |
git status | |
if git diff-index --quiet HEAD --; then | |
printf "No changes\n" | |
else | |
printf "Changes\n" | |
git commit -a -m "Automated deployment to update community posts $(date '+%Y-%m-%d')" | |
git push origin main | |
fi |