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

45 lines
1.4 KiB
YAML

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: true
type: string
txtFileName:
required: true
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 }}
if [ "${{ inputs.uploadName }}" != "" ]; then
echo "Renaming file to ${{ inputs.uploadName }}"
mv ${{ inputs.fileName }} ${{ inputs.uploadName }}
upload_name=${{ inputs.uploadName }}
fi
curl -T ./$upload_name ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"
printf "%b" "${{ inputs.txtFileContent }}" > ${{ inputs.txtFileName }}
curl -T ./${{ inputs.txtFileName }} ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"