Skip to content

Change ref to default branch as main (#2519) #156

Change ref to default branch as main (#2519)

Change ref to default branch as main (#2519) #156

Workflow file for this run

name: github-samples-app
on:
push:
branches:
- main
workflow_dispatch:
# schedule:
# - cron: '55 13 * * *'
# Top-level default; empty/no permissions
permissions: {}
jobs:
pages:
name: Build GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
# Above required for publishing to gh-pages; see auth on Ln 67-68
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: actions/checkout@v3
name: Check out app/dev # checks out app/dev in top-level dir
with:
ref: 'refs/heads/app/dev'
- uses: actions/checkout@v3
name: Check out main # checks out main in subdirectory
with:
ref: 'refs/heads/main'
path: main
- name: Build JSON DB
run: |
python3 -m pip install -r src/requirements.txt
echo main
python3 src/db.py main
- name: Remove JSON pre-prod
run: |
rm -rf src/docs/sample_db_pre.json
- name: Build Sphinx
run: |
python3 -m sphinx -W -b html src/docs/ src/docs/_build/
echo $PWD
echo ${{ github.ref }}
- name: Add GPU-Occupancy-Calculator
env:
GPU_OCC_CALC: src/docs/_build/Tools/GPU-Occupancy-Calculator/
run: |
mkdir -p ${GPU_OCC_CALC}
cp -v ${{ github.workspace }}/main/Tools/GPU-Occupancy-Calculator/index.html ${GPU_OCC_CALC}/index.html
- name: Push docs
if: ${{ github.ref == 'refs/heads/main' }} # only if this workflow is run from the main branch, push docs
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPO: ${{ github.repository }}
run: |
cd src/docs/_build/
touch .nojekyll
git init
git remote add origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPO}"
git add -A
git status
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git commit -sm "$(date)"
git branch -M gh-pages
git push -u origin -f gh-pages