From c9eb00a703607c100682b4562f68e50a423f6d98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20Borbo=C3=ABn?= <ponsfrilus@gmail.com>
Date: Fri, 30 Aug 2019 18:10:28 +0200
Subject: [PATCH] [WIP} is WIP

- Fix expansion bug(s)
- Constantize PROJECT_ID
- Remove unused exports
---
 deploy.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/deploy.sh b/deploy.sh
index c219d1c..6d11519 100755
--- a/deploy.sh
+++ b/deploy.sh
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+PROJECT_ID=1298
+
 set -e -x
 
 env
@@ -27,7 +29,7 @@ whoami
 # git commit -am "New PDF file $(date '+%Y-%m-%d %H:%M:%S')"
 # git push --push-option=ci.skip origin master
 # https://docs.gitlab.com/ee/ci/yaml/README.html#skipping-jobs
-export RELEASE_V=v$(date '+%s')
+RELEASE_V=v$(date '+%s')
 echo "Creating release: ${RELEASE_V}"
 git tag -f -a -m "My sweet release $(date '+%Y-%m-%d %H:%M:%S')" ${RELEASE_V}
 echo "END OF TAGGING"
@@ -36,7 +38,7 @@ git push -f --tags
 echo "END OF PUSH"
 
 echo "BEGIN UPLOAD"
-export UPLOADED_FILE_URL=$(curl --request POST --header "Private-Token: ${MY_TOKEN}" --form "file=@README.pdf" "https://gitlab.epfl.ch/api/v4/projects/1298/uploads" | jq .url)
+UPLOADED_FILE_URL="$(curl --request POST --header "Private-Token: ${MY_TOKEN}" --form "file=@README.pdf" "https://gitlab.epfl.ch/api/v4/projects/1298/uploads" | jq .url)"
 echo "END UPLOAD"
 
 echo "BEGIN POST RELEASE"
@@ -44,8 +46,8 @@ for retry in $(seq 1 5); do
     if curl --request POST \
         --header 'Content-Type: application/json' \
         --header "Private-Token: ${MY_TOKEN}" \
-        --data '{"name": "New README release", "tag_name": "${RELEASE_V}", "description": "Release with the PDF [README.pdf](${UPLOADED_FILE_URL})"}' \
-        "https://gitlab.epfl.ch/api/v4/projects/1298/releases" \
+        --data '{"name": "New README release", "tag_name": "'${RELEASE_V}'", "description": "Release with the PDF [README.pdf]('${UPLOADED_FILE_URL}')"}' \
+        "https://gitlab.epfl.ch/api/v4/projects/'${PROJECT_ID}'/releases" \
         | jq -e ".created_at"
     then
         break
-- 
GitLab