From 529668c4bdd60cfd9166ef9d516f040c622b4998 Mon Sep 17 00:00:00 2001 From: Cat McGee Date: Wed, 10 Jan 2024 00:07:31 +0900 Subject: [PATCH] update workflow --- .github/workflows/update.yml | 4 +- utils/tmp | 1 - utils/update_contract.sh | 85 ------------------------------------ 3 files changed, 2 insertions(+), 88 deletions(-) delete mode 160000 utils/tmp delete mode 100755 utils/update_contract.sh diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index f524f90..29e862d 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -22,9 +22,9 @@ jobs: - name: Get version id: versions_step run: | - version_tag=$(node ./.github/scripts/fetchRelease.js) + version_tag=$(node ./.github/scripts/get_release.js) echo "::set-output name=version_tag::$version_tag" - echo "Output from Node.js script: $version_tag" + echo "Output from get_release script: $version_tag" - name: Check and update tutorials run: sudo chown $USER ./src && bash ./.github/scripts/update_contract.sh ${{ steps.versions_step.outputs.version_tag }} diff --git a/utils/tmp b/utils/tmp deleted file mode 160000 index 1681b39..0000000 --- a/utils/tmp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1681b39426fb6a15921232d6b7d73de6895785a9 diff --git a/utils/update_contract.sh b/utils/update_contract.sh deleted file mode 100755 index 41ad705..0000000 --- a/utils/update_contract.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -# Function to print an error message and exit -error_exit() { - echo "Error: $1" 1>&2 - exit 1 -} - -# Base directories to search through -base_dirs=("../tutorials" "../workshops") - -# Repository details -repo_url="https://github.com/AztecProtocol/aztec-packages.git" -version="aztec-packages-v0.17.0" -contracts_path="yarn-project/noir-contracts/contracts" - -# Clone the repository into a tmp folder once at the beginning -if ! git clone "$repo_url" tmp; then - error_exit "Failed to clone the repository." -fi - -if ! cd tmp || ! git checkout "$version"; then - error_exit "Failed to checkout the specified version." -fi -cd .. - -# Loop through each base directory -for base_dir in "${base_dirs[@]}"; do - echo "Processing $base_dir..." - - # Find directories containing Nargo.toml and loop through them - while IFS= read -r nargo_file_path; do - # Extract the directory path - project_dir=$(dirname "$nargo_file_path") - echo "Found project: $project_dir" - - # Check if the Nargo.toml file exists - if [ ! -f "$nargo_file_path" ]; then - echo "Warning: File not found: $nargo_file_path" - continue - fi - - # Extract the value of the 'name' field - name_value=$(grep "^name\s*=" "$nargo_file_path" | cut -d '"' -f 2) - - # Check if name_value is not empty - if [ -z "$name_value" ]; then - echo "Warning: Name field not found or empty in the TOML file." - continue - else - echo "The value of the 'name' field is: $name_value" - fi - - # Check if the directory exists in the cloned repo - if [ -d "tmp/$contracts_path/$name_value" ]; then - echo "Directory found: $name_value" - - # Define copy location - copy_location="$project_dir/$name_value" - mkdir -p "$copy_location" - - # Copy the contracts - if ! cp -r "tmp/$contracts_path/$name_value/src/"* "$copy_location/"; then - echo "Warning: Failed to copy files to $copy_location" - continue - fi - - echo "Copied the contracts to $copy_location" - - # Remove docs comments from the files - find "$copy_location" -type f -name "*.nr" | while read file; do - if ! sed -i '' '/[ \t]*\/\/ docs:.*/d' "$file"; then - echo "Warning: Failed to remove comments from $file" - else - echo "Comments removed from $file" - fi - done - else - echo "Warning: Directory not found: $name_value" - fi - done < <(find "$base_dir" -name "Nargo.toml") -done - -# Remove temporary files after processing is complete -rm -rf tmp