.github/workflows/deploy_demo.yaml
name: demo repo
on:
workflow_run:
workflows: ["tests"]
types:
- completed
jobs:
deploy:
# check workflow result, as "complete" is triggered regardless of the result
# of the previous workflow
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: demo
concurrency: demo
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: git config
run: |
git config --global user.email "yoko@onyo.org"
git config --global user.name "Yoko Onyo"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Generate and publish a fresh demo repository
env:
ONYO_DEMO_ACCESS_TOKEN: ${{ secrets.ONYO_DEMO_ACCESS_TOKEN }}
run: |
printf '\ngenerate a fresh demo repository\n'
demo/generate_demo_repo.sh /tmp/fresh_demo
printf '\nmake sure we are on the main branch\n'
git -C /tmp/fresh_demo checkout -B main
printf '\nset the location of the demo repo\n'
git -C /tmp/fresh_demo remote add origin https://aqw:${ONYO_DEMO_ACCESS_TOKEN}@github.com/psyinfra/onyo-demo
printf '\npush to onyo-demo\n'
git -C /tmp/fresh_demo push --force --set-upstream origin main