From 6f0f500e62b2959d7c9c9a49e7e4040ddda7ed5e Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 12 Sep 2023 11:37:41 -0700 Subject: [PATCH 1/4] swap Scott O in for Andrew and Charlie in CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a1d812ead..d5f906262 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,3 @@ # repo owners -* @edasmalchi @charlie-costanzo @atvaccaro +* @edasmalchi @owades From 5e36d7258db3e9cae65703df9f84586d3e0fce11 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 12 Sep 2023 11:59:17 -0700 Subject: [PATCH 2/4] add workflow dispatch to manually trigger reports builds without a push or tag --- .github/workflows/main.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af6a757a1..b6f559fd3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,16 @@ name: Build and deploy to Netlify on: + workflow_dispatch: + inputs: + site_target: + description: 'Deploy to development or production Reports site?' + required: true + default: 'dev' + type: choice + options: + - dev + - prod push: tags: - '*' @@ -35,7 +45,7 @@ jobs: # Run data ---- - name: Run report data - if: ${{ github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'}} working-directory: reports run: | make parameters @@ -43,7 +53,7 @@ jobs: # copy data ---- - name: Copy development report data - if: ${{ github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'}} run: | gsutil -m rsync -r reports/outputs/ gs://test-calitp-reports-data/report_gtfs_schedule/ - name: Copy production report data @@ -59,14 +69,14 @@ jobs: # deploy ---- - name: Deploy development to Netlify - if: ${{ github.ref == 'refs/heads/main' }} + 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/') }} + 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 From 304cf058c7930abe3b6ba7247c4614955e288f23 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 12 Sep 2023 13:47:41 -0700 Subject: [PATCH 3/4] document --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 88faabd18..09f828e1f 100644 --- a/README.md +++ b/README.md @@ -177,5 +177,6 @@ Once you've synced data to either development or production, you may deploy the appropriate environment to Netlify. * For development, pushing a commit (or merging a PR) to the `main` branch * For production, pushing a tag +* Alternatively, manually start the workflow and select development or production You may want to monitor GitHub Actions to ensure your deploy succeeded. From 79798942c00d9b35739e71b14ffeaa17f985544c Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi <54728455+edasmalchi@users.noreply.github.com> Date: Tue, 12 Sep 2023 14:21:15 -0700 Subject: [PATCH 4/4] Update main.yml revise conditionals to match dev/prod split on workflow dispatch, too --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b6f559fd3..f039c60df 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: site_target: - description: 'Deploy to development or production Reports site?' + description: 'Deploy to development or production Reports site? (must deploy to development first)' required: true default: 'dev' type: choice @@ -45,7 +45,7 @@ jobs: # Run data ---- - name: Run report data - if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'}} + if: ${{ github.ref == 'refs/heads/main' || inputs.site_target == 'dev'}} working-directory: reports run: | make parameters @@ -53,11 +53,11 @@ jobs: # copy data ---- - name: Copy development report data - if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'}} + 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/') }} + 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/