added workflow for deploying artifacts to webserver
This commit is contained in:
parent
8e8fa8b4cf
commit
257436cbc2
57
.gitea/workflows/deployArtifactToWebserver.yaml
Normal file
57
.gitea/workflows/deployArtifactToWebserver.yaml
Normal file
@ -0,0 +1,57 @@
|
||||
name: Deploy Artifact to Webserver
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
artifactName:
|
||||
required: true
|
||||
type: string
|
||||
fileName:
|
||||
required: true
|
||||
type: string
|
||||
uploadName:
|
||||
required: false
|
||||
type: string
|
||||
dir:
|
||||
required: true
|
||||
type: string
|
||||
txtFileContent:
|
||||
required: false
|
||||
type: string
|
||||
txtFileName:
|
||||
required: false
|
||||
type: string
|
||||
jobs:
|
||||
DeployToWebserver:
|
||||
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
|
||||
|
||||
upload_path=${{ inputs.uploadDir }}
|
||||
|
||||
echo "Uploading $upload_name"
|
||||
curl -d --binary-data @./$upload_name "${{ vars.WEB_DEPLOY_URL }}${{ inputs.dir }}/$upload_name"
|
||||
echo "Uploading finished $upload_name"
|
||||
|
||||
echo "TXT filename is '${{ inputs.txtFileName }}'"
|
||||
if [ "${{ inputs.txtFileName }}" != "-" ]; then
|
||||
echo "Uploading additional text file ${{ inputs.txtFileName }}"
|
||||
printf "%b" "${{ inputs.txtFileContent }}" > ${{ inputs.txtFileName }}
|
||||
curl -d --binary-data @./${{ inputs.txtFileName }} "${{ vars.WEB_DEPLOY_URL }}${{ inputs.dir }}/${{ inputs.txtFileName }}"
|
||||
else
|
||||
echo "No additional text file to upload."
|
||||
fi
|
||||
|
||||
echo "Deploy upload done"
|
Loading…
Reference in New Issue
Block a user