Skip to content

Build and Deploy

Build and Deploy #101

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
schedule:
- cron: "0 10 * * 1"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: pip
- name: Install dependencies
run: |
pip install -e .
- name: Run
run: |
make run
env:
COVALENT_API_KEY: ${{ secrets.COVALENT_API_KEY }}
DUNE_API_KEY: ${{ secrets.DUNE_API_KEY }}
- name: Export Database and Log File Sizes
run: |
make tables
echo "Files exported:" >> $GITHUB_STEP_SUMMARY
{
echo "| Filename | File Size |"
echo "| --- | --- |"
ls -lh data/tables | tail -n +2 | awk '{printf "| %s | %s |\n", $9, $5}'
} >> $GITHUB_STEP_SUMMARY
ls -lh data/tables
- name: Install Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Render
run: |
make render
- name: Upload Pages Artifact
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: actions/upload-pages-artifact@v3
with:
path: portal/_site
- name: Copy Data Tables and Database
run: |
cp -r data/tables/ portal/_site/data/
cp -r data/local.duckdb portal/_site/data/database.duckdb
- name: Push to IPFS
if: github.event_name == 'push' || github.event_name == 'schedule'
uses: filebase/ipfs-action@master
id: ipfs
with:
path: portal/_site/
service: filebase
pinName: gitcoin-grants-data-portal-tables
filebaseBucket: gitcoin-grants-data-portal
filebaseKey: ${{ secrets.FILEBASE_KEY }}
filebaseSecret: ${{ secrets.FILEBASE_SECRET }}
key: gitcoin-grants-data-portal-db
- name: Update CID file
if: github.event_name == 'push' || github.event_name == 'schedule'
run: echo ${{ steps.ipfs.outputs.cid }} > data/IPFS_CID
- name: Commit and Push
if: github.event_name == 'push' || github.event_name == 'schedule'
run: |
git config --global user.name "GitHub Action"
git config --global user.email "actions@users.noreply.github.com"
git add data/IPFS_CID
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
git commit -m "chore: :id: Update CID"
git push
fi
deploy:
if: github.event_name == 'push' || github.event_name == 'schedule'
needs: run
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4