|  | 
| 15 | 15 |   PROJECT_ID: ${{ github.ref == 'refs/heads/main' && 'cal-itp-data-infra' || 'cal-itp-data-infra-staging' }} | 
| 16 | 16 |   DBT_TARGET: ${{ github.ref == 'refs/heads/main' && 'prod' || 'staging' }} | 
| 17 | 17 |   DBT_ARTIFACTS_BUCKET: ${{ github.ref == 'refs/heads/main' && 'calitp-dbt-artifacts' || 'calitp-staging-dbt-artifacts' }} | 
|  | 18 | +  DBT_DOCS_BUCKET: ${{ github.ref == 'refs/heads/main' && 'calitp-dbt-docs' || 'calitp-staging-dbt-docs' }} | 
| 18 | 19 | 
 | 
| 19 | 20 | jobs: | 
| 20 |  | -  extract: | 
| 21 |  | -    name: Extract and Update Exposures | 
|  | 21 | +  compile: | 
|  | 22 | +    name: Compile and Extract Exposures | 
| 22 | 23 |     runs-on: ubuntu-latest | 
| 23 | 24 | 
 | 
| 24 | 25 |     permissions: | 
| @@ -79,106 +80,41 @@ jobs: | 
| 79 | 80 |         working-directory: warehouse | 
| 80 | 81 |         run: poetry run dbt deps | 
| 81 | 82 | 
 | 
| 82 |  | -      - name: Get current timestamp | 
| 83 |  | -        uses: josStorer/get-current-time@v2 | 
| 84 |  | -        id: current-time | 
| 85 |  | -        with: | 
| 86 |  | -          format: "YYYY-MM-DDTHH:mm:ss.SSSSSS+00:00" | 
| 87 |  | -          timezone: "UTC" | 
| 88 |  | - | 
| 89 |  | -      - name: Get current date | 
| 90 |  | -        uses: josStorer/get-current-time@v2 | 
| 91 |  | -        id: current-date | 
| 92 |  | -        with: | 
| 93 |  | -          format: "YYYY-MM-DD" | 
| 94 |  | -          timezone: "UTC" | 
| 95 |  | - | 
| 96 | 83 |       - name: Print dbt environment | 
| 97 | 84 |         working-directory: warehouse | 
| 98 | 85 |         run: poetry run dbt debug --target ${{ env.DBT_TARGET }} | 
| 99 | 86 | 
 | 
| 100 |  | -      - name: Compile dbt | 
|  | 87 | +      - name: Download latest artifacts from GCS | 
| 101 | 88 |         working-directory: warehouse | 
| 102 |  | -        run: poetry run dbt compile --target ${{ env.DBT_TARGET }} --full-refresh | 
| 103 |  | - | 
| 104 |  | -      # - name: Download latest artifacts from GCS | 
| 105 |  | -      #   working-directory: warehouse | 
| 106 |  | -      #   run: gsutil cp -r gs://${{ env.DBT_ARTIFACTS_BUCKET }}/latest/manifest.json ./target | 
|  | 89 | +        run: gsutil cp -r gs://${{ env.DBT_ARTIFACTS_BUCKET }}/latest/manifest.json ./target | 
| 107 | 90 | 
 | 
| 108 |  | -      # - name: Create Metabase folder | 
| 109 |  | -      #   working-directory: warehouse/models | 
| 110 |  | -      #   run: mkdir metabase | 
|  | 91 | +      - name: Create Metabase folder | 
|  | 92 | +        working-directory: warehouse/models | 
|  | 93 | +        run: mkdir metabase | 
| 111 | 94 | 
 | 
| 112 |  | -      # - name: Extract Metabase exposures | 
| 113 |  | -      #   working-directory: warehouse | 
| 114 |  | -      #   run: poetry run dbt-metabase exposures -v --output-grouping="type" --output-path=./models/metabase/ --manifest-path=./target/manifest.json  --metabase-url="https://dashboards.calitp.org" --metabase-api-key="${{ secrets.METABASE_API_KEY }}" | 
|  | 95 | +      - name: Extract Metabase exposures | 
|  | 96 | +        working-directory: warehouse | 
|  | 97 | +        run: poetry run dbt-metabase exposures -v --output-grouping="type" --output-path=./models/metabase/ --manifest-path=./target/manifest.json  --metabase-url="https://dashboards.calitp.org" --metabase-api-key="${{ secrets.METABASE_API_KEY }}" | 
| 115 | 98 | 
 | 
| 116 |  | -      # - name: Compile dbt with exposures | 
| 117 |  | -      #   working-directory: warehouse | 
| 118 |  | -      #   run: poetry run dbt compile --target ${{ env.DBT_TARGET }} --full-refresh | 
|  | 99 | +      - name: Compile dbt with exposures | 
|  | 100 | +        working-directory: warehouse | 
|  | 101 | +        run: poetry run dbt compile --target ${{ env.DBT_TARGET }} --full-refresh | 
| 119 | 102 | 
 | 
| 120 | 103 |       - name: Generate dbt documentation | 
| 121 | 104 |         working-directory: warehouse | 
| 122 | 105 |         run: poetry run dbt docs generate --target ${{ env.DBT_TARGET }} --no-compile | 
| 123 | 106 | 
 | 
| 124 |  | -      - name: Upload Metabase exposures | 
| 125 |  | -        uses: google-github-actions/upload-cloud-storage@v1 | 
|  | 107 | +      - name: Archive compilation artifacts | 
|  | 108 | +        uses: actions/upload-artifact@v4 | 
| 126 | 109 |         with: | 
| 127 |  | -          path: './warehouse/models/exposures/' | 
| 128 |  | -          parent: false | 
| 129 |  | -          process_gcloudignore: false | 
| 130 |  | -          destination: "${{ env.DBT_ARTIFACTS_BUCKET }}/exposures/dt=${{ steps.current-date.outputs.formattedTime }}/ts=${{ steps.current-time.outputs.formattedTime }}/" | 
|  | 110 | +          name: dbt | 
|  | 111 | +          path: | | 
|  | 112 | +            warehouse/target/*.json | 
|  | 113 | +            warehouse/target/*.html | 
| 131 | 114 | 
 | 
| 132 |  | -      - name: Upload catalog.json | 
| 133 |  | -        uses: google-github-actions/upload-cloud-storage@v1 | 
| 134 |  | -        with: | 
| 135 |  | -          path: './warehouse/target/' | 
| 136 |  | -          glob: 'catalog.json' | 
| 137 |  | -          parent: false | 
| 138 |  | -          process_gcloudignore: false | 
| 139 |  | -          destination: "${{ env.DBT_ARTIFACTS_BUCKET }}/catalog.json/dt=${{ steps.current-date.outputs.formattedTime }}/ts=${{ steps.current-time.outputs.formattedTime }}/" | 
| 140 |  | - | 
| 141 |  | -      - name: Upload manifest.json | 
| 142 |  | -        uses: google-github-actions/upload-cloud-storage@v1 | 
| 143 |  | -        with: | 
| 144 |  | -          path: './warehouse/target/' | 
| 145 |  | -          glob: 'manifest.json' | 
| 146 |  | -          parent: false | 
| 147 |  | -          process_gcloudignore: false | 
| 148 |  | -          destination: "${{ env.DBT_ARTIFACTS_BUCKET }}/manifest.json/dt=${{ steps.current-date.outputs.formattedTime }}/ts=${{ steps.current-time.outputs.formattedTime }}/" | 
| 149 |  | - | 
| 150 |  | -      - name: Upload run_results.json | 
| 151 |  | -        uses: google-github-actions/upload-cloud-storage@v1 | 
| 152 |  | -        with: | 
| 153 |  | -          path: './warehouse/target/' | 
| 154 |  | -          glob: 'run_results.json' | 
| 155 |  | -          parent: false | 
| 156 |  | -          process_gcloudignore: false | 
| 157 |  | -          destination: "${{ env.DBT_ARTIFACTS_BUCKET }}/run_results.json/dt=${{ steps.current-date.outputs.formattedTime }}/ts=${{ steps.current-time.outputs.formattedTime }}/" | 
| 158 |  | - | 
| 159 |  | -      - name: Upload index.html | 
| 160 |  | -        uses: google-github-actions/upload-cloud-storage@v1 | 
| 161 |  | -        with: | 
| 162 |  | -          path: './warehouse/target/' | 
| 163 |  | -          glob: 'index.html' | 
| 164 |  | -          parent: false | 
| 165 |  | -          process_gcloudignore: false | 
| 166 |  | -          destination: "${{ env.DBT_ARTIFACTS_BUCKET }}/index.html/dt=${{ steps.current-date.outputs.formattedTime }}/ts=${{ steps.current-time.outputs.formattedTime }}/" | 
| 167 |  | - | 
| 168 |  | -      - name: Upload to latest | 
| 169 |  | -        uses: google-github-actions/upload-cloud-storage@v1 | 
| 170 |  | -        with: | 
| 171 |  | -          path: './warehouse/target/' | 
| 172 |  | -          glob: '{catalog.json,manifest.json,index.html,run_results.json}' | 
| 173 |  | -          parent: false | 
| 174 |  | -          process_gcloudignore: false | 
| 175 |  | -          destination: "${{ env.DBT_ARTIFACTS_BUCKET }}/latest/" | 
| 176 |  | - | 
| 177 |  | -      - name: Upload documentation | 
| 178 |  | -        uses: google-github-actions/upload-cloud-storage@v1 | 
|  | 115 | +      - name: Archive Metabase exposures | 
|  | 116 | +        uses: actions/upload-artifact@v4 | 
| 179 | 117 |         with: | 
| 180 |  | -          path: './warehouse/target/' | 
| 181 |  | -          glob: '{catalog.json,manifest.json,index.html}' | 
| 182 |  | -          parent: false | 
| 183 |  | -          process_gcloudignore: false | 
| 184 |  | -          destination: ${{ env.DBT_DOCS_BUCKET }} | 
|  | 118 | +          name: exposures | 
|  | 119 | +          path: | | 
|  | 120 | +            warehouse/models/metabase/* | 
0 commit comments