From c225fdf980fd2fc160bac992a8503238d486d33e Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Thu, 5 Jun 2025 05:28:58 -0400 Subject: [PATCH] Update action.yml --- action.yml | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index 015f2fc..d7934ab 100644 --- a/action.yml +++ b/action.yml @@ -23,15 +23,29 @@ runs: steps: - run: if [ ${{ inputs.is_folder }} == true ] && [ ! -d ${{ inputs.file }} ]; then echo "Not a folder!"; exit 1; fi - run: if [ ${{ inputs.is_folder }} == false ] && [ ! -f ${{ inputs.file }} ]; then echo "Not a file!"; exit 1; fi - - run: echo "Uploading '${{ inputs.file }}' to '${{ vars.PACK_HOST }}/api/upload/${{ gitea.repository }}/${{ inputs.feature }}'" - - name: 'Upload file' - run: | - curl -v -H 'Authorization: Bearer ${{ inputs.secret }}' \ - -F sha=${{ gitea.sha }} \ - -F ref='${{ gitea.ref }}' \ - -F prefix='${{ inputs.prefix }}' \ - -F filename='${{ inputs.file }}' \ - -F data=@'${{ inputs.file }}' \ - -F is_folder='${{ inputs.is_folder }}' \ - ${{ vars.PACK_HOST }}/api/upload/${{ gitea.repository }}/${{ inputs.feature }} + - run: | + if [ ${{ inputs.is_folder }} == true ]; then \ + echo "Packaging folder..." && + cd ${{ inputs.file }} && + tar -czf file.tgz * && + echo "Uploading '${{ inputs.file }}' to '${{ vars.PACK_HOST }}/api/upload/${{ gitea.repository }}/${{ inputs.feature }}'" && + curl -v -H 'Authorization: Bearer ${{ inputs.secret }}' \ + -F sha=${{ gitea.sha }} \ + -F ref='${{ gitea.ref }}' \ + -F prefix='${{ inputs.prefix }}' \ + -F filename=file.tgz \ + -F data=@file.tgz \ + -F is_folder='${{ inputs.is_folder }}' \ + ${{ vars.PACK_HOST }}/api/upload/${{ gitea.repository }}/${{ inputs.feature }} + else + echo "Uploading '${{ inputs.file }}' to '${{ vars.PACK_HOST }}/api/upload/${{ gitea.repository }}/${{ inputs.feature }}'" && + curl -v -H 'Authorization: Bearer ${{ inputs.secret }}' \ + -F sha=${{ gitea.sha }} \ + -F ref='${{ gitea.ref }}' \ + -F prefix='${{ inputs.prefix }}' \ + -F filename='${{ inputs.file }}' \ + -F data=@'${{ inputs.file }}' \ + -F is_folder='${{ inputs.is_folder }}' \ + ${{ vars.PACK_HOST }}/api/upload/${{ gitea.repository }}/${{ inputs.feature }} + fi - run: echo "Upload complete" \ No newline at end of file