scheduled-publish #488
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: scheduled-publish | |
on: | |
workflow_dispatch: | |
# No inputs required | |
schedule: | |
- cron: '0 0 * * *' | |
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 }} | |
GOOGLE_API_KEY: ${{ secrets.GOOGLE_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: . |