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"
|
description: "Folder to tar, gz and publish"
|
||||||
required: true
|
required: true
|
||||||
default: "dist/"
|
default: "dist/"
|
||||||
|
ignoreFilePath:
|
||||||
|
description: "A git ignore style file to ignore specific files 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,36 @@ 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"
|
||||||
|
--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" ../
|
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