add eager vs lazy evaluation til #207
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: Build and update README, deploy to Heroku, and post to Slack | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out jthodge/til | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
path: main | |
- name: Check out jthodge/til-db | |
uses: actions/checkout@v3 | |
with: | |
repository: jthodge/til-db | |
path: til-db | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_FOR_PUSH }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- uses: actions/cache@v3 | |
name: Configure pip caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r main/requirements.txt | |
- name: Download previous database unless REBUILD in commit message | |
if: |- | |
!contains(github.event.head_commit.message, 'REBUILD') | |
run: curl --fail -o main/til.db https://raw.githubusercontent.com/jthodge/til-db/main/til.db | |
continue-on-error: true | |
- name: Build database | |
env: | |
MARKDOWN_GITHUB_TOKEN: ${{ secrets.MARKDOWN_GITHUB_TOKEN }} | |
run: |- | |
cd main | |
python build_db.py | |
- name: Perform soundness check | |
run: |- | |
cd main | |
datasette . --get / | grep "Taylor Hodge - TIL" | |
- name: Update README | |
run: |- | |
cd main | |
python update_readme.py --rewrite | |
cat README.md | |
- name: Commit and push if README changed | |
run: |- | |
cd main | |
git diff | |
git config --global user.email "j.taylor.hodge@gmail.com" | |
git config --global user.name "jthodge" | |
git diff --quiet || (git add README.md && git commit -m "Updated README") | |
git push | |
- name: Save til.db to jthodge/til-db | |
run: |- | |
cd til-db | |
cp ../main/til.db . | |
git add til.db | |
git commit --amend --no-edit | |
git push --force | |
- name: Deploy Datasette using Heroku | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
run: |- | |
cd main | |
heroku plugins:install heroku-builds | |
datasette publish heroku til.db \ | |
--branch main \ | |
--name til-taylorhodge \ | |
--metadata metadata.yaml \ | |
--static static:static \ | |
--install datasette-template-sql \ | |
--install "datasette-sitemap>=1.0" \ | |
--install "datasette-atom>=0.7" \ | |
--install datasette-json-html \ | |
--install beautifulsoup4 \ | |
--install "datasette-debug-asgi>=1.1" \ | |
--install "datasette-graphql>=2.2" \ | |
--install datasette-block-robots \ | |
--plugins-dir plugins \ | |
--template-dir templates | |
# - name: Post Slack Notification | |
# uses: rtCamp/action-slack-notify@master | |
# env: | |
# SLACK_ICON: https://user-images.githubusercontent.com/17075617/149437305-53baad9e-9800-4fe4-a3bf-13bd28d98f8b.png | |
# SLACK_USERNAME: taylor | |
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |