Publish to GitHub Pages #353
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: Publish to GitHub Pages | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: '0 7 * * *' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Clone Source | |
uses: actions/checkout@v3 | |
- name: Make Directories | |
run: mkdir -p build | |
- uses: pdm-project/setup-pdm@v3 | |
with: | |
python-version: 3.11 | |
cache: false | |
- name: Install dependencies | |
run: pdm install | |
- id: prompt | |
name: Get a random prompt from HuggingFace Hub | |
run: | | |
eval $(pdm venv activate) | |
RANDOM_PROMPT=$(python -m inkwell.prompt) | |
echo "prompt='${RANDOM_PROMPT}'" >> ${GITHUB_OUTPUT} | |
echo ${RANDOM_PROMPT} | tee ./build/prompt.txt | |
- name: Build Resources | |
shell: bash | |
run: | | |
eval $(pdm venv activate) | |
STABILITY_API_KEY="${{ secrets.STABILITY_API_KEY }}" \ | |
PYTHONPATH=$(pwd) \ | |
python -m inkwell.stabilityai \ | |
"${{ steps.prompt.outputs.prompt }}" ./build | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build | |
keep_files: true | |
allow_empty_commit: true # Add a commit anyway to show we tried | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' |