Skip to content

Add Github actions workflow publishing to python-example #13

Add Github actions workflow publishing to python-example

Add Github actions workflow publishing to python-example #13

name: Publish example to python-example
on:
push:
branches: [ main ]
pull_request: # REMOVE THIS BEFORE MERGE
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
publish-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: |
3.8
3.9
3.10
3.11
3.12
- name: Install dependencies
run: pip install cookiecutter tox
- run: mkdir -p /tmp/generated
- run: pwd
- name: Build example repo
working-directory: /tmp/generated
run: |
cookiecutter --config-file ../config/python-example.yaml \
--no-input ../
- name: Generate requirements
working-directory: /tmp/generated/python_example
run: tox run -m requirements
- name: Initialise the git repo
working-directory: /tmp/generated/python_example
run: |
git init
git config user.name "Github actions on vikahl/python-template"
git config user.email "<>"
git remote add python-example "https://vikahl:[email protected]/vikahl/python-example.git"
- name: Unset header that seems to cause auth issues
working-directory: /tmp/generated/python_example
run: git config --unset-all http.https://github.com/.extraheader
- name: Check out a new branch, commit and push
working-directory: /tmp/generated/python_example
run: |
git checkout -b "sync-$COMMIT"
git add .
git commit -m "Sync from vikahl/python-template $COMMIT"
git push python-example main --force