diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 76d5e869d..000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Build -on: - push: - branches: - - dev - workflow_dispatch: # for triggering builds manually - repository_dispatch: - types: - - build -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout this repo - uses: actions/checkout@v3 - with: - persist-credentials: false - - name: Set up Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - uses: actions/cache@v3 - name: Cache dependencies - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Fetch data - run: ./fetch_data.sh - - name: Fetch stats - run: | - mkdir out - ./get_stats.sh - - name: Make plots - run: python plots.py - - name: Build CSV output - run: python make_csv.py - - name: Build HTML output - run: python make_html.py - - name: Delete files - run: rm -rf data stats-calculated - - name: Deploy (production) 🚀 - if: github.ref == 'refs/heads/main' - uses: JamesIves/github-pages-deploy-action@v4 - with: - git-config-name: Code for IATI bot - git-config-email: 57559326+codeforIATIbot@users.noreply.github.com - token: ${{ secrets.TOKEN }} - repository-name: codeforIATI/analytics-public - branch: gh-pages - folder: out - clean: true - silent: true - single-commit: true - - name: Set CNAME (dev) - if: github.ref == 'refs/heads/dev' - run: echo "analytics-dev.codeforiati.org" > out/CNAME - - name: Deploy (dev) 🚀 - if: github.ref == 'refs/heads/dev' - uses: JamesIves/github-pages-deploy-action@v4 - with: - git-config-name: Code for IATI bot - git-config-email: 57559326+codeforIATIbot@users.noreply.github.com - token: ${{ secrets.TOKEN }} - repository-name: codeforIATI/analytics-dev - branch: gh-pages - folder: out - clean: true - silent: true - single-commit: true diff --git a/git.sh b/git.sh new file mode 100755 index 000000000..c6c0e7017 --- /dev/null +++ b/git.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Starting Dashboard generation" + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Removing 'out' directory and creating a new one" +rm -rf out +mkdir out + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Fetching data" +./fetch_data.sh &> fetch_data.log || exit 1 + +cd dashboard + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Running plots.py" +python make_plots.py || exit 1 + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Running make_csv.py" +python make_csv.py || exit 1 + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Running speakers kit.py" +python speakers_kit.py || exit 1 + +cd .. + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Make a backup of the old web directory and make new content live" +rsync -a --delete web web.bk +mv web web.1 +mv out web +rm -rf web.1 + +echo "LOG: `date '+%Y-%m-%d %H:%M:%S'` - Dashboard generation complete"