improved README and workflow #35
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
- github-pages | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository 🛎️ | |
uses: actions/checkout@v4 | |
- name: Set up Python from `.python-version` 🐍 | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: .python-version | |
- name: Install dependencies 📦 | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Initialize Reflex 📦 | |
run: reflex init | |
- name: Build the website 🚧 | |
run: | | |
reflex export --no-zip --frontend-only | |
env: | |
API_URL: "http://www.divingavran.com:8000" | |
- name: Upload frontend build 📦 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: frontend | |
path: .web/_static/ | |
if-no-files-found: error | |
retention-days: 1 | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout the repository 🛎️ | |
uses: actions/checkout@v4 | |
- name: Download website build 📦 | |
uses: actions/download-artifact@v3 | |
with: | |
name: frontend | |
path: frontend/ | |
- name: Deploy to GitHub Pages 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: frontend/ | |
# This part is important, otherwise GitHub Pages will try to build the website as a Jekyll website | |
- name: Checkout branch 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: Check if .nojekyll exists 📦 | |
id: check_files | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: ".nojekyll" | |
- name: Touch .nojekyll 👉 | |
if: steps.check_files.outputs.files_exists == 'false' | |
run: | | |
touch .nojekyll | |
- name: Commit changes 📦 | |
if: steps.check_files.outputs.files_exists == 'false' | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add .nojekyll | |
git commit -m "Added .nojekyll" | |
git push |