How to upload the build on Sauce Lab / Test-Fairy through azure devops pipelines

How to upload the build on Sauce Lab / Test-Fairy through azure DevOps pipelines. I am a microsoft VS App center user where i'm distributing the non prod apps to testers, as many of you know VS app center got retired on March 31, 2025, we are looking for some alternatives and landed on Sauce Lab / Test-Fairy.
Answer
- task: DownloadPipelineArtifact@2
displayName: 'Download APK Artifact'
inputs:
buildtype: 'current'
downloadtype: 'specific'
downloadPath: '$(System.ArtifactoryDirectory)'
targetPath: '$(System.ArtifactoryDirectory)'
- task: Bash@3
displayName: 'Copy and Upload to Saucelab TestFairy'
inputs:
targetType: inline
script: |
#!/bin/bash
# Define directories
SOURCE_DIR="$(System.ArtifactsDirectory)"
DEFAULT_DIR="$(System.DefaultWorkingDirectory)"
DEST_DIR="$(System.DefaultWorkingDirectory)/artifacts"
ARTIFACT_PATH="$DEST_DIR/$FILE_NAME"
TESTFAIRY_URL="https://app.testfairy.com/api/upload"
API_KEY="MENTION YOUR TEST FAIRY ACCOUNT APY KEY/ DO NOT ENTER SAUCELAB API KEY"
# Create destination directory if it doesn't exist
mkdir -p "$DEST_DIR"
# Copy artifacts (.ipa or .apk) from the downloaded folder
find "$SOURCE_DIR" -type f \( -name "*.ipa" -o -name "*.apk" \) -exec cp {} "$DEST_DIR" \;
find "$DEFAULT_DIR" -type f \( -name "*.ipa" -o -name "*.apk" \) -exec cp {} "$DEST_DIR" \;
echo "Artifact files copied to $DEST_DIR"
# List files in destination directory
ls -al "$DEST_DIR"
# Upload artifact file to TestFairy if it exists
if [ -f "$ARTIFACT_PATH" ]; then
echo "✅ Artifact file found. Uploading to TestFairy..."
curl -X POST "$TESTFAIRY_URL" \
-H "Content-Type: multipart/form-data" \
-F "api_key=$API_KEY" \
-F "file=@$ARTIFACT_PATH"
else
echo "❌ Error: Artifact file not found at $ARTIFACT_PATH!" >&2
exit 1
fi
Enjoyed this article?
Check out more content on our blog or follow us on social media.
Browse more articles