From 9f2b5714339a7fe9563b858a9d5fe7dd82fefa7c Mon Sep 17 00:00:00 2001 From: jffarge Date: Tue, 22 Mar 2022 17:12:13 +0100 Subject: [PATCH] update netlify cli deploy command Signed-off-by: jffarge --- pkg/universe.dagger.io/netlify/deploy.sh | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/universe.dagger.io/netlify/deploy.sh b/pkg/universe.dagger.io/netlify/deploy.sh index b1ceef72..85f5034b 100755 --- a/pkg/universe.dagger.io/netlify/deploy.sh +++ b/pkg/universe.dagger.io/netlify/deploy.sh @@ -22,11 +22,12 @@ create_site() { jq -r '.site_id' body } -site_id=$(curl -s -S -f -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \ - "https://api.netlify.com/api/v1/sites?filter=all" | \ - jq -r ".[] | select(.name==\"$NETLIFY_SITE_NAME\") | .id" \ - ) -if [ -z "$site_id" ] ; then +site_id=$( + curl -s -S -f -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \ + "https://api.netlify.com/api/v1/sites?filter=all" | + jq -r ".[] | select(.name==\"$NETLIFY_SITE_NAME\") | .id" +) +if [ -z "$site_id" ]; then if [ "${NETLIFY_SITE_CREATE:-}" != 1 ]; then echo "Site $NETLIFY_SITE_NAME does not exist" exit 1 @@ -42,20 +43,19 @@ if [ -z "$site_id" ] ; then fi netlify link --id "$site_id" -netlify build netlify deploy \ - --dir="$(pwd)" \ + --build \ --site="$site_id" \ - --prod \ -| tee /tmp/stdout + --prodIfUnlocked | + tee /tmp/stdout -url="$(]+' | head -1)" -deployUrl="$(]+' | head -1)" -logsUrl="$(]+' | head -1)" +url="$(grep ]+' | head -1)" +deployUrl="$(grep ]+' | head -1)" +logsUrl="$(grep ]+' | head -1)" # Write output files mkdir -p /netlify -echo -n "$url" > /netlify/url -echo -n "$deployUrl" > /netlify/deployUrl -echo -n "$logsUrl" > /netlify/logsUrl +echo -n "$url" >/netlify/url +echo -n "$deployUrl" >/netlify/deployUrl +echo -n "$logsUrl" >/netlify/logsUrl