Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/chainloop_contract_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,23 @@ jobs:
with:
fetch-depth: 0

- name: Update contracts ${{ inputs.contract_root_folder }} on Chainloop
- name: Sync contracts ${{ inputs.contract_root_folder }} on Chainloop
run: |
for file in $(ls ${{ inputs.contract_root_folder }}); do
if [[ $file = *.yml || $file = *.yaml ]]; then
contract_name=$(basename $file | cut -d'.' -f1)
echo "Updating contract $contract_name with ${{ inputs.contract_root_folder }}/$file"
chainloop wf contract update --name $contract_name --contract ${{ inputs.contract_root_folder }}/$file
fi
done
for file in $(ls ${{ inputs.contract_root_folder }}); do
if [[ $file = *.yml || $file = *.yaml ]]; then
contract_name=$(basename $file | cut -d'.' -f1)
contract_file="${{ inputs.contract_root_folder }}/$file"

echo "Checking if contract $contract_name exists..."
if chainloop wf contract describe --name $contract_name >/dev/null 2>&1; then
echo "Contract $contract_name exists, updating..."
chainloop wf contract update --name $contract_name --contract $contract_file
else
echo "Contract $contract_name does not exist, creating..."
chainloop wf contract create --name $contract_name --contract $contract_file
fi
fi
done

env:
CHAINLOOP_VERSION: ${{ inputs.chainloop_version }}
Expand Down
Loading