1
0
reusable-workflows/.gitea/workflows/uploadArtifactWithFtp.yaml

55 lines
1.7 KiB
YAML
Raw Normal View History

2024-10-24 08:59:16 +00:00
name: Upload artifact With Ftp
on:
workflow_call:
inputs:
artifactName:
required: true
type: string
fileName:
required: true
type: string
uploadName:
required: false
type: string
ftpPath:
required: true
type: string
txtFileContent:
required: false
type: string
txtFileName:
required: false
type: string
jobs:
UploadFtp:
runs-on: ubuntu-latest
steps:
- name: Load Artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifactName }}
path: ./
- name: Upload
run: |
upload_name=${{ inputs.fileName }}
2024-10-24 09:47:59 +00:00
if [ "${{ inputs.uploadName }}" != "" ]; then
2024-10-24 08:59:16 +00:00
echo "Renaming file to ${{ inputs.uploadName }}"
mv ${{ inputs.fileName }} ${{ inputs.uploadName }}
upload_name=${{ inputs.uploadName }}
fi
echo "Uploading $upload_name"
curl -T ./$upload_name ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"
echo "Uploading finished $upload_name"
2024-10-24 10:03:31 +00:00
echo "TXT Filename is '${{ inputs.txtFileName }}'"
if [ "${{ inputs.txtFileName }}" != "skip" ]; then
2024-10-24 09:14:28 +00:00
echo "Uploading additional Text File ${{ inputs.txtFileName }}"
2024-10-24 08:59:16 +00:00
printf "%b" "${{ inputs.txtFileContent }}" > ${{ inputs.txtFileName }}
curl -T ./${{ inputs.txtFileName }} ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"
2024-10-24 09:43:24 +00:00
else
echo "No additional text file to upload."
2024-10-24 08:59:16 +00:00
fi
2024-10-24 09:14:28 +00:00
2024-10-24 08:59:16 +00:00
echo "Ftp Upload done"