Merge pull request #55 from jduar/dev #22
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: Generate example website and deploy | |
on: | |
push: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create env file | |
run: | | |
touch .env | |
echo "PAGES_FOLDER=./example_content/pages" >> .env | |
echo "PICTURES_FOLDER=./example_content/images" >> .env | |
echo "FAVICON=./example_content/favicon.ico" >> .env | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' # caching pip dependencies | |
- run: pip install -r requirements.txt | |
- run: python3 generator.py | |
- name: Init new repo and commit generated files | |
run: | | |
mv ./example_content/images ./public/images | |
cd public | |
git init | |
git add --all | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git commit -m 'deploy' | |
- name: Force push to destination branch | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
force: true | |
directory: ./public | |