Skip to content

Merge pull request #273 from cal-itp/fix-rt-scraper #225

Merge pull request #273 from cal-itp/fix-rt-scraper

Merge pull request #273 from cal-itp/fix-rt-scraper #225

Workflow file for this run

name: Build and deploy to Netlify
on:
push:
tags:
- '*'
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install python packages
run: |
pip install -r requirements.txt
- name: Install node packages
run: npm install
working-directory: website
- uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
# Run data ----
- name: Run report data
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: reports
run: |
make parameters
make data
# copy data ----
- name: Copy development report data
if: ${{ github.ref == 'refs/heads/main' }}
run: |
gsutil -m rsync -r reports/outputs/ gs://test-calitp-reports-data/report_gtfs_schedule/
- name: Copy production report data
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
gsutil -m rsync -r gs://test-calitp-reports-data/report_gtfs_schedule/ gs://calitp-reports-data/report_gtfs_schedule/
gsutil -m rsync -r gs://gtfs-data/report_gtfs_schedule/ reports/outputs/
# build ----
- name: Build
run: npm run build
working-directory: website
# deploy ----
- name: Deploy development to Netlify
if: ${{ github.ref == 'refs/heads/main' }}
run: |
npm install netlify-cli
netlify deploy --site=cal-itp-reports --dir=./website/build --alias=test
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: Deploy production to Netlify
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
npm install netlify-cli
netlify deploy --site=cal-itp-reports --dir=./website/build --prod
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}