feat: add artifact zipping option and update upload steps

This commit is contained in:
Leandro Costa 2026-03-07 11:13:01 -03:00
parent aa49da3631
commit 50326ce91f

View file

@ -27,6 +27,11 @@ inputs:
default: dist default: dist
required: false required: false
should_zip_artifact:
description: Whether to zip the artifact before uploading
default: "false"
required: false
runs: runs:
using: composite using: composite
steps: steps:
@ -53,15 +58,29 @@ runs:
npm run ${{ inputs.test_action }} npm run ${{ inputs.test_action }}
npm run ${{ inputs.build_action }} npm run ${{ inputs.build_action }}
- name: Zip Artifact
if: ${{ inputs.should_zip_artifact == 'true' }}
shell: sh
run: |
tar -czf ${{ inputs.artifact_name }}.tar.gz -C ${{ inputs.build_path }} .
echo "Artifact zipped: ${{ inputs.artifact_name }}.tar.gz"
- name: Store Node Modules Cache - name: Store Node Modules Cache
if: always()
uses: actions/cache/save@v4 uses: actions/cache/save@v4
with: with:
path: ~/.npm path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
if: ${{ inputs.should_zip_artifact == 'false' }}
name: Build-Node-App Upload Artifact name: Build-Node-App Upload Artifact
with: with:
name: ${{ inputs.artifact_name }} name: ${{ inputs.artifact_name }}
path: ${{ inputs.build_path }} path: ${{ inputs.build_path }}
- uses: actions/upload-artifact@v3
if: ${{ inputs.should_zip_artifact == 'true' }}
name: Build-Node-App Upload Zipped Artifact
with:
name: ${{ inputs.artifact_name }}
path: ${{ inputs.artifact_name }}.tar.gz