-
Notifications
You must be signed in to change notification settings - Fork 46
Site Builds
If you need to manually build the site for some reason, that has to be done from the admin console at http://netlify.com.
We are employing Netlify's Gatsby caching mechanism to do differential builds, so only pages that are updated are rebuilt. That generally means a given build will only take a couple of minutes.
Site builds for the live site are done automatically whenever things like blog posts, distributions, featured add-ons, and store items (which are managed using a web interface) are updated.
Netlify has a bot that monitors builds. If you request a number of builds back-to-back (like editing a bunch of blog posts quickly), the bot will hold all the changes until there haven't been any for a few minutes. Then it will build everything once. So if you did a bunch of edits and are wondering why the site hasn't rebuilt yet, that's probably why. Wait a few minutes, and the system should catch up.
Any time new updates are pushed to the kodi-tv
repo's main
branch, that triggers a site build at Netlify.
There is a scheduled GitHub action that grabs a current copy of the site code, runs a build, and then pushes updated files (the history.json
for each Add-on repo the site tracks plus any new/updated add-on images) back to the kodi-tv
repo's main
branch. That then triggers a site build at Netlify. If there are no add-on updates, there will be no site update. That Github action is currently scheduled to run at 2am UTC. It can also be triggered manually from the Actions tab of the repo.
The GitHub action is stored in the repo at .github/workflows/update-addon-history.yml
. Here's the current action:
name: Update Add-on History
on:
workflow_dispatch:
schedule:
- cron: '00 02 * * *'
jobs:
add-on-update:
name: Update Add-on History
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache gatsby paths
uses: actions/cache@v2
id: gatsbycache
with:
path: |
.cache
public
key: ${{ runner.os }}-gatsby-caches-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-gatsby-caches
- name: Cache npm node nodules
uses: actions/cache@v2
id: nodecache
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}
- name: Set Node Version
uses: actions/setup-node@master
with:
node-version: 12.x
- name: Install dependencies
if: steps.nodecache.outputs.cache-hit != 'true'
run: npm install
- name: Build Gatsby site
run: npm run build
env:
GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true
- name: Push new files back
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: 'main'
The action loads the current main
branch, loads any existing caches of node_modules/Gatsby, installs dependencies (only if the package.json for the site has changed), builds the Gatsby site, saves the udpated Gatsby cache, and then pushes the changed files to the main
branch. The caching helps cut the run time down from about 8 minutes for the first run to about 4 minutes for all subsequent runs.