|
| 1 | +name: github-samples-app |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +# schedule: |
| 11 | +# - cron: '55 13 * * *' |
| 12 | + |
| 13 | +jobs: |
| 14 | + pages: |
| 15 | + name: Build GitHub Pages |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Set up Python |
| 20 | + uses: actions/setup-python@v4 |
| 21 | + with: |
| 22 | + python-version: "3.8" |
| 23 | + |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + name: Check out app/dev # checks out app/dev in top-level dir |
| 26 | + with: |
| 27 | + ref: 'refs/heads/app/dev' |
| 28 | + |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + name: Check out master # checks out master in subdirectory |
| 31 | + with: |
| 32 | + ref: 'refs/heads/master' |
| 33 | + path: master |
| 34 | + |
| 35 | + - name: Build JSON DB |
| 36 | + run: | |
| 37 | + python3 -m pip install -r src/requirements.txt |
| 38 | + echo master |
| 39 | + python3 src/db.py master |
| 40 | +
|
| 41 | + - name: Remove JSON pre-prod |
| 42 | + run: | |
| 43 | + rm -rf src/docs/sample_db_pre.json |
| 44 | +
|
| 45 | + - name: Build Sphinx |
| 46 | + run: | |
| 47 | + python3 -m sphinx -W -b html src/docs/ src/docs/_build/ |
| 48 | + echo $PWD |
| 49 | + echo ${{ github.ref }} |
| 50 | +
|
| 51 | + - name: Add GPU-Occupancy-Calculator |
| 52 | + env: |
| 53 | + GPU_OCC_CALC: src/docs/_build/Tools/GPU-Occupancy-Calculator/ |
| 54 | + run: | |
| 55 | + mkdir -p ${GPU_OCC_CALC} |
| 56 | + cp -v ${{ github.workspace }}/master/Tools/GPU-Occupancy-Calculator/index.html ${GPU_OCC_CALC}/index.html |
| 57 | +
|
| 58 | + - name: Push docs |
| 59 | + if: ${{ github.ref == 'refs/heads/master' }} # only if this workflow is run from the master branch, push docs |
| 60 | + env: |
| 61 | + GITHUB_USER: ${{ github.actor }} |
| 62 | + GITHUB_TOKEN: ${{ github.token }} |
| 63 | + GITHUB_REPO: ${{ github.repository }} |
| 64 | + run: | |
| 65 | + cd src/docs/_build/ |
| 66 | + touch .nojekyll |
| 67 | + git init |
| 68 | + git remote add origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPO}" |
| 69 | + git add -A |
| 70 | + git status |
| 71 | + git config --global user.name "GitHub Actions" |
| 72 | + git config --global user.email "[email protected]" |
| 73 | + git commit -sm "$(date)" |
| 74 | + git branch -M gh-pages |
| 75 | + git push -u origin -f gh-pages |
0 commit comments