Update Site #685
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 1 * * * | |
jobs: | |
auto-scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create conda environment | |
run: conda create --quiet -c conda-forge --name hpc requests | |
- name: Update posts | |
run: | | |
echo "Looking for new posts..." | |
export PATH="/usr/share/miniconda/bin:$PATH" | |
source activate hpc | |
pip install -r .github/requirements.txt | |
python scripts/generate_posts.py ./_data/authors.yml --output ./_posts/ | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
- 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 ./_posts/* | |
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 |