Merge pull request #282 from cal-itp/dependabot/pip/urllib3-1.26.17 #237
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy to Netlify | |
on: | |
workflow_dispatch: | |
inputs: | |
site_target: | |
description: 'Deploy to development or production Reports site? (must deploy to development first)' | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- prod | |
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' || inputs.site_target == 'dev'}} | |
working-directory: reports | |
run: | | |
make parameters | |
make data | |
# copy data ---- | |
- name: Copy development report data | |
if: ${{ github.ref == 'refs/heads/main' || inputs.site_target == 'dev'}} | |
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/') || inputs.site_target == 'prod'}} | |
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://calitp-reports-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' || inputs.site_target == 'dev'}} | |
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/' || inputs.site_target == 'prod') }} | |
run: | | |
npm install netlify-cli | |
netlify deploy --site=cal-itp-reports --dir=./website/build --prod | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |