From 460e421aaaf69e139ab2bfb4740879d54f60b7ca Mon Sep 17 00:00:00 2001 From: Michal Charemza Date: Sat, 10 Aug 2024 16:11:41 +0100 Subject: [PATCH] ci: fix creating .tar.gz of source but versioned Getting an error from GitHub actions: > tar: .: file changed as we read it Which might be because the archive .tar.gz is being created in the directory being archived. Creating the file first and then excluding it should sort this. --- .github/workflows/deploy-package-to-pypi.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-package-to-pypi.yml b/.github/workflows/deploy-package-to-pypi.yml index a8c0964..e0106b2 100644 --- a/.github/workflows/deploy-package-to-pypi.yml +++ b/.github/workflows/deploy-package-to-pypi.yml @@ -22,7 +22,8 @@ jobs: # See https://github.com/uktrade/stream-zip/issues/136 - name: Update release to include source code with version run: | - tar --exclude='./.git' -czvf "${GITHUB_REF_NAME}.tar.gz" . + touch "${GITHUB_REF_NAME}.tar.gz" + tar --exclude='.git' --exclude='${GITHUB_REF_NAME}.tar.gz' -czvf "${GITHUB_REF_NAME}.tar.gz" . gh release upload "${GITHUB_REF_NAME}" "${GITHUB_REF_NAME}.tar.gz" "Source code (with release version)" rm "${GITHUB_REF_NAME}.tar.gz"