Check tag exists, fail if not

This commit is contained in:
nemunaire 2022-09-08 18:34:47 +02:00
parent 924e79b2c9
commit 997d10593a
1 changed files with 1 additions and 0 deletions

View File

@ -72,6 +72,7 @@ steps:
- echo "$${SSH_PRIVATE_KEY}" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- git ls-remote --tags "${REPO_URL}" | grep -q "refs/tags/${REPO_TAG}" || { echo "No tag found (was looking for ${REPO_TAG})" >&2; exit 1; }
- git clone --depth 1 --branch $$(git ls-remote --tags "${REPO_URL}" | grep "refs/tags/${REPO_TAG}" | tail -n 1 | sed 's@/@ @;s@/@ @' | awk '{ print $$4 }') ${REPO_URL} "/work/${LOGIN}"
- tar cJf "/work/rendu-${LOGIN}.tar.xz" --exclude-vcs -C /work "${LOGIN}/"
- "echo -e '{\"filename\": \"rendu-${LOGIN}.tar.xz\", \"size\": '$$(du -s ${LOGIN}/ | awk \'{ print $1 }\')', \"date_now\": \"'$$(date -Iseconds)'\", \"date\": \"'$$(git -C \'/work/${LOGIN}\' log -1 --format=%cd --date=iso-strict)'\", \"tag\": \"'$(git -C \'/work/${LOGIN}\' describe --tags)'\", \"commit\": \"'$$(git -C \'/work/${LOGIN}\' rev-parse HEAD)'\"}' >> /work/rendu-${LOGIN}.metadata"