mkdocs-deploy #86
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: mkdocs-deploy | |
on: | |
workflow_run: | |
workflows: ["RELEASE"] | |
types: | |
- completed | |
schedule: | |
- cron: '0 6 * * 1' # Runs every Monday at 6 AM UTC | |
workflow_dispatch: # Option to also manually trigger the workflow | |
permissions: | |
contents: write | |
env: | |
LIBRARY_ID: ${{ secrets.LIBRARY_ID }} | |
ZOTERO_API_KEY: ${{ secrets.ZOTERO_API_KEY }} | |
TEST_COLLECTION_KEY: ${{ secrets.TEST_COLLECTION_KEY }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Set up Git Credentials | |
- uses: actions/checkout@v4 | |
- name: Configure Git Credentials | |
run: | | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
# Install requirements | |
- name: Install the requirements | |
shell: bash -l {0} | |
run: | | |
pip3 install mkdocs mkdocs-material mkdocs-material-extensions mkdocstrings mkdocstrings-python | |
pip3 install -r requirements.txt | |
# Run the literature_fetch_recommendations script | |
- name: Run literature_fetch | |
shell: bash -l {0} | |
run: | | |
cd app/code | |
python3 literature_fetch_recommendation_api.py | |
# Set up mkdocs website | |
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- run: pip install mkdocs-material | |
- run: mkdocs gh-deploy --force | |
# Commit the files | |
- name: Commit files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add -A | |
git commit -m "update data" -a | |
# Push the file to GitHub | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |