1+ #
2+ # Reusable workflow that deploys the artifacts produced by github.com/duckdb/duckdb/.github/workflows/_extension_distribution.yml
3+ #
4+ # note: this workflow needs to be located in the extension repository, as it requires secrets to be passed to the
5+ # deploy script. However, it should generally not be necessary to modify this workflow in your extension repository, as
6+ # this workflow can be configured to use a custom deploy script.
7+
8+
9+ name : Extension Deployment
10+ on :
11+ workflow_call :
12+ inputs :
13+ # The name of the extension
14+ extension_name :
15+ required : true
16+ type : string
17+ # DuckDB version to build against
18+ duckdb_version :
19+ required : true
20+ type : string
21+ # ';' separated list of architectures to exclude, for example: 'linux_amd64;osx_arm64'
22+ exclude_archs :
23+ required : false
24+ type : string
25+ default : " "
26+ # Whether to upload this deployment as the latest. This may overwrite a previous deployment.
27+ deploy_latest :
28+ required : false
29+ type : boolean
30+ default : false
31+ # Whether to upload this deployment under a versioned path. These will not be deleted automatically
32+ deploy_versioned :
33+ required : false
34+ type : boolean
35+ default : false
36+ # Postfix added to artifact names. Can be used to guarantee unique names when this workflow is called multiple times
37+ artifact_postfix :
38+ required : false
39+ type : string
40+ default : " "
41+ # Override the default deploy script with a custom script
42+ deploy_script :
43+ required : false
44+ type : string
45+ default : " ./scripts/extension-upload.sh"
46+ # Override the default matrix parse script with a custom script
47+ matrix_parse_script :
48+ required : false
49+ type : string
50+ default : " ./duckdb/scripts/modify_distribution_matrix.py"
51+
52+ jobs :
53+ generate_matrix :
54+ name : Generate matrix
55+ runs-on : ubuntu-latest
56+ outputs :
57+ deploy_matrix : ${{ steps.parse-matrices.outputs.deploy_matrix }}
58+ steps :
59+ - uses : actions/checkout@v3
60+ with :
61+ fetch-depth : 0
62+ submodules : ' true'
63+
64+ - name : Checkout DuckDB to version
65+ run : |
66+ cd duckdb
67+ git checkout ${{ inputs.duckdb_version }}
68+
69+ - id : parse-matrices
70+ run : |
71+ python3 ${{ inputs.matrix_parse_script }} --input ./duckdb/.github/config/distribution_matrix.json --deploy_matrix --output deploy_matrix.json --exclude "${{ inputs.exclude_archs }}" --pretty
72+ deploy_matrix="`cat deploy_matrix.json`"
73+ echo deploy_matrix=$deploy_matrix >> $GITHUB_OUTPUT
74+ echo `cat $GITHUB_OUTPUT`
75+
76+ deploy :
77+ name : Deploy
78+ runs-on : ubuntu-latest
79+ needs : generate_matrix
80+ if : ${{ needs.generate_matrix.outputs.deploy_matrix != '{}' && needs.generate_matrix.outputs.deploy_matrix != '' }}
81+ strategy :
82+ matrix : ${{fromJson(needs.generate_matrix.outputs.deploy_matrix)}}
83+
84+ steps :
85+ - uses : actions/checkout@v3
86+ with :
87+ fetch-depth : 0
88+ submodules : ' true'
89+
90+ - name : Checkout DuckDB to version
91+ run : |
92+ cd duckdb
93+ git checkout ${{ inputs.duckdb_version }}
94+
95+ - uses : actions/download-artifact@v2
96+ with :
97+ name : ${{ inputs.extension_name }}-${{ inputs.duckdb_version }}-extension-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}
98+ path : |
99+ /tmp/extension
100+
101+ - name : Deploy
102+ shell : bash
103+ env :
104+ AWS_ACCESS_KEY_ID : ${{ secrets.S3_DEPLOY_ID }}
105+ AWS_SECRET_ACCESS_KEY : ${{ secrets.S3_DEPLOY_KEY }}
106+ AWS_DEFAULT_REGION : ${{ secrets.S3_REGION }}
107+ BUCKET_NAME : ${{ secrets.S3_BUCKET }}
108+ DUCKDB_EXTENSION_SIGNING_PK : ${{ secrets.DUCKDB_EXTENSION_SIGNING_PK }}
109+ run : |
110+ pwd
111+ python3 -m pip install pip awscli
112+ git config --global --add safe.directory '*'
113+ cd duckdb
114+ git fetch --tags
115+ export DUCKDB_VERSION=`git tag --points-at HEAD`
116+ export DUCKDB_VERSION=${DUCKDB_VERSION:=`git log -1 --format=%h`}
117+ cd ..
118+ git fetch --tags
119+ export EXT_VERSION=`git tag --points-at HEAD`
120+ export EXT_VERSION=${EXT_VERSION:=`git log -1 --format=%h`}
121+ ${{ inputs.deploy_script }} ${{ inputs.extension_name }} $EXT_VERSION $DUCKDB_VERSION ${{ matrix.duckdb_arch }} $BUCKET_NAME ${{inputs.deploy_latest || 'true' && 'false'}} ${{inputs.deploy_versioned || 'true' && 'false'}}
0 commit comments