diff --git a/.github/workflows/github-actions-data-stack.yml b/.github/workflows/github-actions-data-stack.yml index 3e9c32d4d..4263e538c 100644 --- a/.github/workflows/github-actions-data-stack.yml +++ b/.github/workflows/github-actions-data-stack.yml @@ -19,3 +19,40 @@ jobs: alias: metabase-production branch: main secrets: inherit + + build-and-upload-dbt-doc: + name: Build and Upload DBT Documentation + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install dbt + run: | + python -m pip install --upgrade pip + pip install dbt-core dbt-postgres + + - name: Build DBT Docs + run: | + dbt docs generate + mkdir -p dbt_docs + mv target/* dbt_docs/ + + - name: Configure AWS CLI + env: + CELLAR_KEY_ID: ${{ secrets.CELLAR_KEY_ID }} + CELLAR_KEY_SECRET: ${{ secrets.CELLAR_KEY_SECRET }} + run: | + aws configure set aws_access_key_id $CELLAR_KEY_ID + aws configure set aws_secret_access_key $CELLAR_KEY_SECRET + + - name: Upload DBT Docs to Cellar + env: + DBT_DOC_BUCKET_NAME: ${{ secrets.DBT_DOC_BUCKET_NAME }} + run: | + aws s3 sync dbt_docs/ s3://$DBT_DOC_BUCKET_NAME --acl public-read --endpoint-url https://cellar-c2.services.clever-cloud.com