Made the tar command more customizable
This commit is contained in:
33
action.yml
33
action.yml
@@ -14,6 +14,10 @@ inputs:
|
|||||||
description: "Folder to tar, gz and publish"
|
description: "Folder to tar, gz and publish"
|
||||||
required: true
|
required: true
|
||||||
default: "dist/"
|
default: "dist/"
|
||||||
|
ignorePatterns:
|
||||||
|
description: "A comma separated string of file patterns to ignore relative to the publish folder."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
customArchiveName:
|
customArchiveName:
|
||||||
description: "Custom archive name, useful for multi-arch"
|
description: "Custom archive name, useful for multi-arch"
|
||||||
required: false
|
required: false
|
||||||
@@ -27,12 +31,39 @@ runs:
|
|||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Packaging App
|
- name: Packaging App
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
log_info "Packaging app into $(yellow)${{ inputs.customArchiveName }}"
|
log_info "Packaging app into $(yellow)${{ inputs.customArchiveName }}"
|
||||||
cd "${{ inputs.publishFolder }}"
|
cd "${{ inputs.publishFolder }}"
|
||||||
tar -cvzf "${{ inputs.customArchiveName }}.tar.gz" *
|
|
||||||
|
shopt -s dotglob
|
||||||
|
|
||||||
|
# Build tar command dynamically
|
||||||
|
tar_cmd=(
|
||||||
|
tar
|
||||||
|
-cvzf "${{ inputs.customArchiveName }}.tar.gz"
|
||||||
|
)
|
||||||
|
|
||||||
|
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" ../
|
mv "${{ inputs.customArchiveName }}.tar.gz" ../
|
||||||
- name: Publishing App
|
- name: Publishing App
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
PKG_URL="${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/generic/${{ inputs.appName }}/${{ inputs.version }}/${{ inputs.customArchiveName }}.tar.gz"
|
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}"
|
log_info "Sending package in $(yellow)${PKG_URL}"
|
||||||
|
|||||||
Reference in New Issue
Block a user