Made the tar command more customizable
This commit is contained in:
30
action.yml
30
action.yml
@@ -14,6 +14,10 @@ inputs:
|
||||
description: "Folder to tar, gz and publish"
|
||||
required: true
|
||||
default: "dist/"
|
||||
ignoreFilePath:
|
||||
description: "A git ignore style file to ignore specific files relative to the publish folder."
|
||||
required: false
|
||||
default: ""
|
||||
customArchiveName:
|
||||
description: "Custom archive name, useful for multi-arch"
|
||||
required: false
|
||||
@@ -27,12 +31,36 @@ 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"
|
||||
--exclude-vcs
|
||||
)
|
||||
|
||||
# Add --exclude-from if ignoreFilePath is provided
|
||||
if [[ -n "${{ inputs.ignoreFilePath }}" ]]; then
|
||||
tar_cmd+=(--exclude-from="${{ inputs.ignoreFilePath }}")
|
||||
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}"
|
||||
|
||||
Reference in New Issue
Block a user