Skip to content

scheduled-publish

scheduled-publish #181

name: scheduled-publish
on:
workflow_dispatch:
# No inputs required
schedule:
- cron: '0 0 */2 * *'
jobs:
add-blog-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
shell: bash -el {0}
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
- name: Checkout ecrivai-blog-hugo with submodules
uses: actions/checkout@v3
with:
submodules: true
- name: Checkout ecrivai
uses: actions/checkout@v3
with:
repository: ruankie/ecrivai
path: ecrivai
- name: Setup and activate conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: ecrivai
environment-file: ecrivai/conda.yml
auto-activate-base: false
- name: Create blog post
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: python ecrivai/ecrivai/add_blog.py --out-dir "content/posts"
- name: Remove ecrivai repo
run: rm -rf ecrivai
- name: Rebuild static site with Hugo
run: hugo -d docs
- name: Commit and push changes to ecrivai-blog-hugo
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Auto add blog post
repository: .