If you want to add a pipeline to your Bitbucket repository and deploy your project automatically when a new change is committed, you can use this YAML configuration sample:
image: mcr.microsoft.com/dotnet/sdk:8.0
pipelines:
default:
- step:
name: Build and Deploy
script:
- echo "Restoring..."
- dotnet restore YourProjectName/YourProjectName.csproj
- echo "Building..."
- dotnet build YourProjectName/YourProjectName.csproj --no-restore
- echo "Publishing..."
- dotnet publish YourProjectName/YourProjectName.csproj --no-build -c Release -o ./publish
- echo "Deploying..."
- apt-get update
- apt-get -qq install lftp
- lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_SERVER; mirror -Rev ./publish /path/to/your/server/directory --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"