Update image #368
This file contains hidden or 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
# This workflow builds live website on master commits. | |
name: CI | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
outputs: | |
update_commit: ${{ steps.commit_changes.outputs.update_commit }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
fetch-depth: 0 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
architecture: 'x64' | |
- name: Run last-updated script | |
run: ./scripts/last-updated.py | |
- name: Check if files were updated | |
id: check_status | |
run: | | |
if [[ -n $(git status source --porcelain) ]]; then | |
echo "changes=true" >> "$GITHUB_OUTPUT"; | |
fi | |
- name: Commit changes | |
id: commit_changes | |
if: steps.check_status.outputs.changes == 'true' | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add source | |
git commit -m "last updated" | |
echo "update_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
git diff HEAD^ HEAD | |
git push | |
build: | |
needs: update | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
with: | |
# Use "last updated" commit from update job if created | |
ref: ${{ needs.update.outputs.update_commit }} | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
# Semantic version range syntax or exact version of a Python version | |
python-version: '3.12' | |
# Optional - x64 or x86 architecture, defaults to x64 | |
architecture: 'x64' | |
- name: Install FE dependencies | |
run: npm install | |
- name: Build styles | |
run: npm start | |
- name: Create virtual environment | |
run: python3 -m venv koboenv | |
- name: Activate virtual environment | |
run: source koboenv/bin/activate | |
- name: Install requirements | |
run: pip install -r requirements.txt | |
- name: Build public files | |
run: make html | |
- name: Disable Jekyll | |
run: touch _build/html/.nojekyll | |
- name: Deploy to gh-pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_build/html | |
publish_branch: gh-pages | |
cname: support.kobotoolbox.org |