Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ jobs:
ruby-version: '2.7'
bundler-cache: true

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install npm dependencies (Biga + Sourdough for import_file)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm ci

- name: Deploy
env:
AWS_REGION: us-east-1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
build/
vendor/
.vercel
node_modules/
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@dbt-labs:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the github token to be able to pull in biga as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure on this, I think I have updated this now to use the builtin github actions for this.

32 changes: 32 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require 'open-uri'
require 'json'
require 'time'

class Middleman::Util::EnhancedHash
# Mila: Looked into Hashie::Mash's source code where this class is
Expand Down Expand Up @@ -151,6 +153,30 @@ def combine_packages(packages)

set :package_index, combine_packages(@app.data.packages)

# Fetches repository metadata from the GitHub API.
def fetch_github_repo(org, repo)
url = "https://api.github.com/repos/#{org}/#{repo}"
options = {
'Accept' => 'application/vnd.github+json',
'X-GitHub-Api-Version' => '2022-11-28',
'User-Agent' => 'hub.getdbt.com-middleman-build',
open_timeout: 5,
read_timeout: 5
}
JSON.parse(URI.open(url, options).read)
end

# Fetch live description for each featured package at build time.
featured_live = {}
@app.data.featured.each do |feat|
repo = fetch_github_repo(feat['org'], feat['package'])
live = {
'description' => repo['description'],
}.compact
featured_live["#{feat['org']}/#{feat['package']}"] = live
end
set :featured_live, featured_live

after_configuration do

proxy "/api/v1/packages.json",
Expand Down Expand Up @@ -220,6 +246,12 @@ def combine_packages(packages)
ignore '/api/v1/package.template.json.erb'
ignore '/api/v1/raw.json.erb'

# Vendor CSS from npm (Biga tokens must load before Sourdough). Requires `npm install`.
import_file File.expand_path('node_modules/@dbt-labs/biga/tokens/tokens.css', root),
'/stylesheets/vendor/biga-tokens.css'
import_file File.expand_path('node_modules/@dbt-labs/sourdough/dist/sourdough.css', root),
'/stylesheets/vendor/sourdough.css'

activate :livereload

configure :development do
Expand Down
30 changes: 24 additions & 6 deletions data/featured.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
[
{
"org": "dbt-labs",
"package": "dbt_utils"
"package": "dbt_utils",
"tile": {
"description": "Utility functions for dbt projects"
}
},
{
"org": "dbt-labs",
"package": "codegen"
"package": "codegen",
"tile": {
"description": "Macros that generate dbt code"
}
},
{
"org": "dbt-labs",
"package": "dbt_project_evaluator"
"package": "dbt_project_evaluator",
"tile": {
"description": "This package contains macros and models to find DAG issues automatically"
}
},
{
"org": "dbt-labs",
"package": "audit_helper"
"package": "audit_helper",
"tile": {
"description": "Useful macros when performing data audits"
}
},
{
"org": "dbt-labs",
"package": "dbt_external_tables"
"package": "dbt_external_tables",
"tile": {
"description": "dbt macros to stage external source"
}
},
{
"org": "metaplane",
"package": "dbt_expectations"
"package": "dbt_expectations",
"tile": {
"description": "Great Expectations tests for dbt models"
}
}
]
Loading
Loading