1
0
This commit is contained in:
Marco Maatz 2024-10-24 10:53:05 +02:00
parent 108c7c26d6
commit 34da23de0a

View File

@ -1,49 +1,50 @@
name: Upload artifact With Ftp name: Upload artifact With Ftp
on: on:
workflow_call: workflow_call:
inputs: inputs:
artifactName: artifactName:
required: true required: true
type: string type: string
fileName: fileName:
required: true required: true
type: string type: string
uploadName: uploadName:
required: false required: false
type: string type: string
ftpPath: ftpPath:
required: true required: true
type: string type: string
txtFileContent: txtFileContent:
required: false required: false
type: string type: string
txtFileName: txtFileName:
required: false required: false
type: string type: string
jobs: jobs:
UploadFtp: UploadFtp:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Load Artifact - name: Load Artifact
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: ${{ inputs.artifactName }} name: ${{ inputs.artifactName }}
path: ./ path: ./
- name: Upload - name: Upload
run: | run: |
upload_name=${{ inputs.fileName }} upload_name=${{ inputs.fileName }}
if [ "${{ inputs.uploadName }}" != "" ]; then if [ "${{ inputs.uploadName }}" != "" ]; then
echo "Renaming file to ${{ inputs.uploadName }}" echo "Renaming file to ${{ inputs.uploadName }}"
mv ${{ inputs.fileName }} ${{ inputs.uploadName }} mv ${{ inputs.fileName }} ${{ inputs.uploadName }}
upload_name=${{ inputs.uploadName }} upload_name=${{ inputs.uploadName }}
fi fi
echo "Uploading $upload_name" echo "Uploading $upload_name"
curl -T ./$upload_name ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}" curl -T ./$upload_name ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"
echo "Uploading finished $upload_name"
if [ "${{ inputs.txtFileName }}" != "" ]; then
echo "Uploading additional Text File ${{ inputs.txtFileName }}" if [ "${{ inputs.txtFileName }}" != "" ]; then
printf "%b" "${{ inputs.txtFileContent }}" > ${{ inputs.txtFileName }} echo "Uploading additional Text File ${{ inputs.txtFileName }}"
curl -T ./${{ inputs.txtFileName }} ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}" printf "%b" "${{ inputs.txtFileContent }}" > ${{ inputs.txtFileName }}
fi curl -T ./${{ inputs.txtFileName }} ${{ vars.FTP_SERVER_URL }}${{ inputs.ftpPath }} --user "${{ vars.FTP_USER }}:${{ vars.FTP_PASSWORD }}"
fi