Skip to content

requires-python >= 3.9 #92

requires-python >= 3.9

requires-python >= 3.9 #92

Workflow file for this run

name: Update demo
on:
push:
branches:
- main
jobs:
update_demo:
runs-on: ubuntu-latest
steps:
- name: Checkout datasette-plugin
uses: actions/checkout@v3
with:
path: main
- name: Checkout datasette-plugin-template-demo
uses: actions/checkout@v3
with:
repository: simonw/datasette-plugin-template-demo
path: datasette-plugin-template-demo-current
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_FOR_PUSH }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pip
- name: Install dependencies
run: |
pip install -r main/requirements.txt
- name: Run tests
run: python -m pytest main/tests
- name: Build demo from template
run: |-
cat main/input-for-demo.txt | cookiecutter main
find datasette-plugin-template-demo
- name: Push to git
env:
PERSONAL_ACCESS_TOKEN_FOR_PUSH: ${{ secrets.PERSONAL_ACCESS_TOKEN_FOR_PUSH }}
run: |-
# Move the .git folder across
mv datasette-plugin-template-demo-current/.git datasette-plugin-template-demo
# Commit and push the changes
cd datasette-plugin-template-demo
git config user.name "Automated"
git config user.email "[email protected]"
git add -A .
git commit -m "Demo of https://github.com/simonw/datasette-plugin/commit/${GITHUB_SHA}" || exit 0
git push -u origin main
- name: Post commit comment
run: |-
cd datasette-plugin-template-demo
export FULL_SHA=$(git rev-parse HEAD)
export SHORT_SHA=${FULL_SHA::8}
export NEWLINE=$'\n'
echo '{}' | jq --arg v "Demo: https://github.com/simonw/datasette-plugin-template-demo/tree/$SHORT_SHA" \
'. + { body: $v }' | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/comments"