Skip to content

Commit

Permalink
Merge pull request #19 from godatadriven/add-upload-to-motherduck-action
Browse files Browse the repository at this point in the history
Add github action to upload to Motherduck
  • Loading branch information
JCZuurmond committed Aug 25, 2023
2 parents 8a4884e + 312f691 commit ec17c44
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/upload_duckdb_database_to_motherduck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Upload duckdb database to Motherduck

on:
workflow_dispatch:
workflow_run:
workflows:
- Run dbt
types:
- completed

env:
DUCKDB_DATABASE: github_contributions
DUCKDB_PATH: github_contributions.duckdb
DUCKDB_VERSION: v0.8.1

jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Download duckdb
uses: dawidd6/action-download-artifact@v2
with:
name: ${{ env.DUCKDB_PATH }}
workflow: dbt.yml
workflow_conclusion: success

- uses: opt-nc/[email protected]
with:
version: ${{ env.DUCKDB_VERSION }}

- name: Install duckdb
run: |
git clone https://github.com/duckdb/duckdb.git
cd duckdb
git checkout ${{ env.DUCKDB_VERSION }}
make -j8
- name: Upload duckdb database to Motherduck
run: |
./duckdb -c ".open md:" -s "DROP DATABASE IF EXISTS ${{ env.DUCKDB_DATABASE }}"
./duckdb -c ".open md:" -s "CREATE DATABASE ${{ env.DUCKDB_DATABASE }} FROM '${{ env.DUCKDB_PATH }}'"
env:
motherduck_token: ${{ secrets.MOTHERDUCK_TOKEN }}

0 comments on commit ec17c44

Please sign in to comment.