Skip to content

Instantly share code, notes, and snippets.

@jphenow
Created November 10, 2017 22:50
Show Gist options
  • Save jphenow/64c38eaa4669630f3e9a7e103b8617ce to your computer and use it in GitHub Desktop.
Save jphenow/64c38eaa4669630f3e9a7e103b8617ce to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
# Set to your project name
project="Highrise.VisualStudio.Plugin"
assetPath="$project/bin/Release/net461"
targetReleaseDir="./release"
# Find mpack asset from bin dir and make sure it's the latest one
sourceAsset=$(find $assetPath -name "${project}.${project}_*.mpack" | head -1)
if [[ -z $sourceAsset ]]; then
echo "Couldn't find an asset to publish"
exit 1;
fi
echo "Copying asset with new name..."
# Ensure release/ dir exists
mkdir -p $targetReleaseDir
# Pluck version from filename, which comes from Properties/AddinInfo
version=$(echo $sourceAsset | sed "s:.*${project}.${project}_\(.*\).mpack:\1:")
# Copy it out to a `release/ dir so don't mess with build assets directly
targetFile="$project-$version.mpack"
targetFullPath="$targetReleaseDir/$targetFile"
cp $sourceAsset $targetFullPath
echo "Prepping to release v$version with asset $targetFile"
hub release create -a $targetFullPath -m "Release v$version" v$version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment