Skip to content

Commit

Permalink
Merge branch 'BETA_prod'
Browse files Browse the repository at this point in the history
  • Loading branch information
luutuankiet committed Aug 27, 2024
2 parents f1e67fe + f60fd9e commit 997d264
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 2 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/close-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: close-preview

on:
pull_request:
types: [closed, merged]
types: [closed]

jobs:
preview:
Expand Down
89 changes: 89 additions & 0 deletions .github/workflows/gh_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: deploy-lightdash

on:
push:
branches: [ "main", "master" ]

env:
DBT_VERSION: "1.7.10"

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Cache Python packages
- name: Cache Python packages
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.local
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v1
with:
python-version: "3.9.x"

- name: Install Python dependencies
run: |
pip install -r requirements.txt
pip install dbt-core==$DBT_VERSION dbt-postgres==$DBT_VERSION dbt-redshift==$DBT_VERSION dbt-snowflake==$DBT_VERSION dbt-bigquery==$DBT_VERSION
dbt deps --project-dir "$PROJECT_DIR"
# Cache npm packages
- name: Cache npm packages
uses: actions/cache@v3
with:
path: |
~/.npm
~/.cache/npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- uses: actions/[email protected]

- name: Copy Google credentials file
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
if: "${{ env.GOOGLE_CREDENTIALS != '' }}"
id: create-json
uses: jsdaniell/[email protected]
with:
name: "googlecredentials.json"
json: ${{ env.GOOGLE_CREDENTIALS }}

- name: Move credentials to /tmp
run: mv googlecredentials.json /tmp || true

- name: Locate dbt_project.yml
run: echo "PROJECT_DIR=$(find . -name "dbt_project.yml" | sed 's/dbt_project.yml//g')" >> $GITHUB_ENV

- name: Get lightdash version
uses: sergeysova/jq-action@v2
id: version
env:
LIGHTDASH_URL: ${{ secrets.LIGHTDASH_URL }}
with:
cmd: curl -s "${LIGHTDASH_URL}/api/v1/health" | jq -r '.results.version'

- name: Copy profiles.yml
env:
config: ${{ secrets.DBT_PROFILES }}
run: echo -e "$config" > profiles.yml

- name: Install lightdash CLI
run: npm install -g "@lightdash/cli@${{ steps.version.outputs.value }}" || npm install -g @lightdash/cli@latest

- name: Lightdash CLI deploy
env:
LIGHTDASH_API_KEY: ${{ secrets.LIGHTDASH_API_KEY }}
LIGHTDASH_PROJECT: ${{ secrets.LIGHTDASH_PROJECT }}
LIGHTDASH_URL: ${{ secrets.LIGHTDASH_URL }}
GOOGLE_APPLICATION_CREDENTIALS: '/tmp/googlecredentials.json'
run: lightdash deploy --project-dir "$PROJECT_DIR" --profiles-dir . --profile prod || lightdash deploy --project-dir "$PROJECT_DIR" --profiles-dir .
File renamed without changes.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"yaml.schemas": {
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_yml_files-latest.json": [
"/**/*.yml",
"/dbt_project/**/*.yml",
"!profiles.yml",
"!dbt_project.yml",
"!packages.yml",
Expand Down

0 comments on commit 997d264

Please sign in to comment.