File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -28,15 +28,23 @@ jobs:
2828 with :
2929 fetch-depth : 0
3030
31- - name : Update contracts ${{ inputs.contract_root_folder }} on Chainloop
31+ - name : Sync contracts ${{ inputs.contract_root_folder }} on Chainloop
3232 run : |
33- for file in $(ls ${{ inputs.contract_root_folder }}); do
34- if [[ $file = *.yml || $file = *.yaml ]]; then
35- contract_name=$(basename $file | cut -d'.' -f1)
36- echo "Updating contract $contract_name with ${{ inputs.contract_root_folder }}/$file"
37- chainloop wf contract update --name $contract_name --contract ${{ inputs.contract_root_folder }}/$file
38- fi
39- done
33+ for file in $(ls ${{ inputs.contract_root_folder }}); do
34+ if [[ $file = *.yml || $file = *.yaml ]]; then
35+ contract_name=$(basename $file | cut -d'.' -f1)
36+ contract_file="${{ inputs.contract_root_folder }}/$file"
37+
38+ echo "Checking if contract $contract_name exists..."
39+ if chainloop wf contract describe --name $contract_name >/dev/null 2>&1; then
40+ echo "Contract $contract_name exists, updating..."
41+ chainloop wf contract update --name $contract_name --contract $contract_file
42+ else
43+ echo "Contract $contract_name does not exist, creating..."
44+ chainloop wf contract create --name $contract_name --contract $contract_file
45+ fi
46+ fi
47+ done
4048
4149 env :
4250 CHAINLOOP_VERSION : ${{ inputs.chainloop_version }}
You can’t perform that action at this time.
0 commit comments