Skip to content

Update jekyll.yml #1962

Update jekyll.yml

Update jekyll.yml #1962

Workflow file for this run

name: Build, Deploy, and Add Posts to Spaced Inbox
on:
push:
branches: ["main"]
repository_dispatch:
types: [trigger-jekyll]
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
sudo apt-get install sqlite3
- name: Cache tag data
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.jekyll-cache
key: tag-data-${{ github.sha }}
save-always: true
restore-keys: |
tag-data-
- name: Cache Jekyll _site directory
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/_site
key: jekyll-site-${{ github.sha }}
save-always: true
restore-keys: |
jekyll-site-
- name: Process markdown files for tags
run: python tags.py
- name: Fetch calendar events
run: python events.py
- name: Commit and push changes (pre-build)
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add --all
git commit --allow-empty -m "Commit ${GITHUB_SHA}" || echo "Nothing to commit"
git push origin main || echo "Nothing to push"
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
env:
PAGES_REPO_NWO: marioseixas/marioseixas.github.io
JEKYLL_ENV: production
base_path: ""
run: |
echo "base_path from env is: ${base_path}"
export base_path="${base_path}"
echo "base_path after export is: ${base_path}"
bundle exec jekyll build --trace --config _config.yml --baseurl "${basepath}"
- name: Generate Pagefind Index
run: |
npx -y pagefind --site ${{ github.workspace }}/_site --output-path ${{ github.workspace }}/_site/pagefind
- name: Modify Pagefind UI
run: python modify-pagefind-ui.py
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ github.workspace }}/_site
publish_branch: gh-pages
cname: ib.bsb.br
allow_empty_commit: true
enable_jekyll: false
keep_files: true
add-posts-to-inbox:
runs-on: ubuntu-latest
needs: build-and-deploy
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[skip ci]') == false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Python dependencies
run: |
pip install matplotlib
- name: Initialize spaced-inbox database
run: |
if [ ! -f data.db ]; then
sqlite3 data.db < schema.sql
fi
- name: Extract post URLs
id: extract-urls
run: |
BASE_URL="ib.bsb.br"
POST_FILES=$(git diff --name-only HEAD^ HEAD -- '_posts/**.md')
POST_URLS=""
for POST in $POST_FILES; do
FILENAME=$(basename "$POST" .md)
SLUG=$(echo "$FILENAME" | sed 's/^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-//')
POST_URL="$BASE_URL/$SLUG/"
POST_URLS="$POST_URLS\n$POST_URL"
done
echo -e "$POST_URLS" > post_urls.txt
- name: Append URLs to inbox file
run: |
if [ -s post_urls.txt ]; then
while read -r URL; do
echo -e "\n$URL\n=====" >> infoBAG.txt
done < post_urls.txt
fi
shell: bash
- name: Print inbox_files.txt contents
run: cat infoBAG.txt
- name: Run spaced inbox script
run: |
python script.py --no-review
shell: /usr/bin/bash -e {0}
env:
TERM: xterm
- name: Run review load visualizer
run: |
python review_load.py data.db
- name: Configure Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Stage Changes
run: git add --all
- name: Commit and Push
run: |
git commit -m "Update spaced-inbox with new posts" || echo "No changes to commit"
git pull --rebase
git push --force-with-lease