diff --git a/.github/workflows/terraform-modules-oci-release.yml b/.github/workflows/terraform-modules-oci-release.yml index c120fc1..07e1a7d 100644 --- a/.github/workflows/terraform-modules-oci-release.yml +++ b/.github/workflows/terraform-modules-oci-release.yml @@ -54,5 +54,11 @@ jobs: run: | ls -la echo "${{ steps.prepare_tag.outputs.VERSION }}" - ls -la ${{ inputs.organization_layer_name }}/${{ inputs.team_name }}/${{ inputs.products_path }}/**/terraform -# bash -x ./publish-oci.sh ${{ steps.prepare_tag.outputs.VERSION }} + basePath="${{ inputs.organization_layer_name }}/${{ inputs.team_name }}/${{ inputs.products_path }}" + for terraformPath in $(find "$basePath" -type d -name 'terraform' -exec dirname {} \; | sed "s|^$basePath/||" | sort | uniq); do + productName=$(echo "$terraformPath" | sed 's/\//-/g') + echo "Publishing $productName" + echo ${{ steps.prepare_tag.outputs.VERSION }} "${basePath}/${terraformPath}/terraform" "${{ inputs.organization_layer_name }}-${{ inputs.team_name }}-${productName}" +# bash -x ./publish-oci.sh ${{ steps.prepare_tag.outputs.VERSION }} "${basePath}/${terraformPath}/terraform" "${{ inputs.organization_layer_name }}-${{ inputs.team_name }}-${productName}" + done +# diff --git a/platform/infrastructure-utility-plane/products/infraform/publish-oci.sh b/platform/infrastructure-utility-plane/products/infraform/publish-oci.sh index dbba50a..e0ffc93 100644 --- a/platform/infrastructure-utility-plane/products/infraform/publish-oci.sh +++ b/platform/infrastructure-utility-plane/products/infraform/publish-oci.sh @@ -1,36 +1,23 @@ pushd . -REPOSITORY=konpyutaika/data-mesh - -tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) -cd $tmp_dir - -git clone https://github.com/${REPO} -cd aws-primitive-modules -TAG=$(git rev-parse --short HEAD) +REPOSITORY=konpyutaika/data-mesh SOURCE="$(git config --get remote.origin.url)" REVISION="$(git branch --show-current)/$(git rev-parse HEAD)" -rm -rf .git || true -rm -rf .github || true -rm Makefile -rm *.sh -rm $(find . -name "README.md") - flux push artifact \ - oci://ghcr.io/${REPO}:$PROVIDER_VERSION-$TAG \ - --path="./" \ + oci://ghcr.io/${REPOSITORY}/$3:$TAG \ + --path="$2" \ --source=$SOURCE \ --revision=$REVISION flux tag artifact \ - oci://ghcr.io/${REPO}:$PROVIDER_VERSION-$TAG \ + oci://ghcr.io/${REPOSITORY}/$3:$TAG \ --tag latest flux tag artifact \ - oci://ghcr.io/${REPO}:$PROVIDER_VERSION-$TAG \ - --tag $PROVIDER_VERSION-$1 + oci://ghcr.io/${REPOSITORY}/$3:$TAG \ + --tag $1 rm -rf $tmp_dir