-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from godatadriven/add-upload-to-motherduck-action
Add github action to upload to Motherduck
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
.github/workflows/upload_duckdb_database_to_motherduck.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |