djLint/.github/workflows/demo.yml
2022-12-19 11:52:20 -06:00

70 lines
1.7 KiB
YAML

name: demo
on:
workflow_dispatch:
push:
branches: [master]
jobs:
django:
name: format_django
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Setup Poetry
uses: snok/install-poetry@v1
- name: install
run: |
poetry install
- name: get source
run: |
mkdir django_raw; mkdir django_source
cd django_raw; git clone --depth 1 https://github.com/django/django .; cd ..
find django_raw -iname '*.html*' -exec mv '{}' django_source/ \;
- name: publish source
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./django_source
publish_branch: django-source
enable_jekyll: true
force_orphan: true
- name: cleanup source
run: rm -r django_source; rm -r django_raw
- uses: actions/checkout@v3
with:
path: django-source
ref: django-source
- name: setup branch
run: |
cd django-source
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
git branch --unset-upstream
git push --force --set-upstream origin django-djlint
- name: format
run: |
cd src
poetry run python -m djlint ../django-source --profile=django --reformat --warn --quiet
- name: publish foramtted
run: |
cd django-source
git add .
git commit -m "formatted"
git push