diff --git a/action.yml b/action.yml index 75a4f79..8fd1a3f 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,10 @@ inputs: description: "Folder to tar, gz and publish" required: true default: "dist/" + ignorePatterns: + description: "A comma separated string of file patterns to ignore relative to the publish folder." + required: false + default: "" customArchiveName: description: "Custom archive name, useful for multi-arch" required: false @@ -27,12 +31,40 @@ runs: using: composite steps: - name: Packaging App + shell: bash run: | log_info "Packaging app into $(yellow)${{ inputs.customArchiveName }}" cd "${{ inputs.publishFolder }}" - tar -cvzf "${{ inputs.customArchiveName }}.tar.gz" * + + shopt -s dotglob + + # Build tar command dynamically + tar_cmd=( + tar + -cvzf "${{ inputs.customArchiveName }}.tar.gz" + -v + ) + + if [[ -n "${{ ignorePatterns }}" ]]; then + IFS=',' read -ra exclusions <<< "${{ ignorePatterns }}" + + for exclusion in "${exclusions[@]}"; d + tar_cmd+=(--exclude="${exclusion}") + log_info "Excluding pattern ${exclusion}" + done + fi + + # Add all files + tar_cmd+=(*) + + # Execute the tar command + "${tar_cmd[@]}" + + shopt -u dotglob + mv "${{ inputs.customArchiveName }}.tar.gz" ../ - name: Publishing App + shell: bash run: | PKG_URL="${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/${{ inputs.appName }}/${{ inputs.version }}/${{ inputs.customArchiveName }}.tar.gz" log_info "Sending package in $(yellow)${PKG_URL}"