Skip to content

Commit 01d1841

Browse files
committed
New build/relwase script
1 parent ca5776f commit 01d1841

27 files changed

+293
-108
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Properties StartupConfiguration="{80136911-3220-460B-867D-E1C94E241248}|Default">
2+
<MonoDevelop.Ide.Workbench ActiveDocument="DbUp.Support.SqlServer.Scripting.Console/packages.config">
3+
<Files>
4+
<File FileName="DbUp.Support.SqlServer.Scripting.Console/packages.config" Line="1" Column="1" />
5+
<File FileName="DbUp.Support.SqlServer.Scripting/packages.config" Line="1" Column="1" />
6+
</Files>
7+
</MonoDevelop.Ide.Workbench>
8+
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
9+
<MonoDevelop.Ide.DebuggingService.Breakpoints>
10+
<BreakpointStore />
11+
</MonoDevelop.Ide.DebuggingService.Breakpoints>
12+
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
13+
<MonoDevelop.Ide.ItemProperties.DbUp.Support.SqlServer.Scripting.Console PreferredExecutionTarget="MonoDevelop.Default" />
14+
<MultiItemStartupConfigurations />
15+
</Properties>

build/Gemfile

-4
This file was deleted.

build/Gemfile.lock

-26
This file was deleted.

build/README.md

-20
This file was deleted.

build/Rakefile

-50
This file was deleted.

build/exclude.txt

-1
This file was deleted.

build/nuget.exe

-1.61 MB
Binary file not shown.

build/version.txt

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
3+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
4+
<Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
5+
<Default Extension="nuspec" ContentType="application/octet" />
6+
<Default Extension="dll" ContentType="application/octet" />
7+
<Default Extension="config" ContentType="application/octet" />
8+
<Default Extension="pdb" ContentType="application/octet" />
9+
<Default Extension="psm1" ContentType="application/octet" />
10+
<Default Extension="ps1" ContentType="application/octet" />
11+
</Types>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
3+
<Relationship Type="http://schemas.microsoft.com/packaging/2010/07/manifest" Target="/dbup-sqlserver-scripting.nuspec" Id="R20044d36f4da47b1" />
4+
<Relationship Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="/package/services/metadata/core-properties/4dfc29f526184beca2892bca839033de.psmdcp" Id="Rd5971da503d64057" />
5+
</Relationships>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
3+
<metadata>
4+
<id>dbup-sqlserver-scripting</id>
5+
<version>1.6.0</version>
6+
<title>DbUp SQL Server Object Scripting</title>
7+
<authors>Brady Holt</authors>
8+
<owners>Brady Holt</owners>
9+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
10+
<licenseUrl>https://raw.github.com/bradyholt/dbup-sqlserver-scripting/master/LICENSE</licenseUrl>
11+
<projectUrl>https://github.com/bradyholt/dbup-sqlserver-scripting</projectUrl>
12+
<iconUrl>https://raw.github.com/DbUp/DbUp/master/src/Information/dbup-icon.png</iconUrl>
13+
<description>Extends DbUp to provide SQL Server object definition scripting when running migrations from Visual Studio. When a database object changes during a migration, its definition will be saved in the project.</description>
14+
<releaseNotes>v1.6.0 - Update library versions</releaseNotes>
15+
<copyright>Copyright 2017</copyright>
16+
<tags>dbup database migrations sqlserver scripting definitions scripts console</tags>
17+
<dependencies>
18+
<dependency id="dbup" version="3.2.1" />
19+
<dependency id="dbup-consolescripts" version="1.0.9" />
20+
<dependency id="Unofficial.Microsoft.SQLServer.SMO.2014" version="12.0.2000.8" />
21+
</dependencies>
22+
</metadata>
23+
</package>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<runtime>
4+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentity name="Microsoft.SqlServer.Diagnostics.STrace" publicKeyToken="89845dcd8080cc91" culture="neutral" />
7+
<bindingRedirect oldVersion="0.0.0.0-14.100.0.0" newVersion="14.100.0.0" />
8+
</dependentAssembly>
9+
</assemblyBinding>
10+
</runtime>
11+
</configuration>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<coreProperties xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties">
3+
<dc:creator>Brady Holt</dc:creator>
4+
<dc:description>Extends DbUp to provide SQL Server object definition scripting when running migrations from Visual Studio. When a database object changes during a migration, its definition will be saved in the project.</dc:description>
5+
<dc:identifier>dbup-sqlserver-scripting</dc:identifier>
6+
<version>1.6.0</version>
7+
<keywords>dbup database migrations sqlserver scripting definitions scripts console</keywords>
8+
<lastModifiedBy>NuGet, Version=4.3.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35;Unix 16.7.0.0;.NET Framework 4.5</lastModifiedBy>
9+
</coreProperties>

scripts/release.js

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/local/bin/jbash
2+
3+
/* Releases dbup-sqlserver-scripting
4+
This includes: building in release mode, packaging, and publishing on
5+
NuGet, creating a GitHub release, uploading .nupkg to GitHub release.
6+
7+
Example:
8+
release.sh 2.0.0 "Fixed DOW bug causing exception" */
9+
10+
// Halt on an error
11+
set("-e");
12+
13+
// cd to root dir
14+
cd(`${__dirname}/../`);
15+
16+
if (args.length != 2) {
17+
echo(`
18+
Usage: release.sh version "Release notes..."
19+
Example:
20+
release.js 2.0.0 "Fixed bug causing exception"`);
21+
exit(1);
22+
}
23+
24+
if ($(`git status --porcelain`)) {
25+
echo(`All changes must be committed first.`);
26+
exit(1);
27+
}
28+
29+
let projectId = "dbup-sqlserver-scripting";
30+
let projectName = "DbUp.Support.SqlServer.Scripting";
31+
let version = args[0];
32+
let notes = args[1];
33+
let preRelease = version.indexOf("-") > -1; // If version contains a '-' character (i.e. 2.0.0-alpha-1) we will consider this a pre-release
34+
let projectCopyright = `Copyright ${(new Date).getFullYear()}`;
35+
let ghRepo = "bradyholt/dbup-sqlserver-scripting";
36+
let buildDirectory = "tmp";
37+
38+
// Restore NuGet pakcages and build in release mode
39+
eval(`nuget restore`);
40+
eval(`xbuild /property:Configuration=Release ${projectName}.sln`);
41+
42+
// Create NuGet package
43+
eval(`mkdir -p ${buildDirectory}/pack/lib/net35`)
44+
eval(`cp dbup-sqlserver-scripting.nuspec tmp/pack`)
45+
eval(`cp -r tools dbup-sqlserver-scripting.nuspec ${buildDirectory}/pack/`)
46+
eval(`cp -r ${projectName}/bin/Release/${projectName}.* ${buildDirectory}/pack/lib/net35`)
47+
eval(`nuget pack ${buildDirectory}/pack/${projectId}.nuspec -Properties "version=${version};notes=v${version} - ${notes};copyright=${projectCopyright}" -OutputDirectory ${buildDirectory}`)
48+
let nupkgFile = `${buildDirectory}/${projectId}.${version}.nupkg`;
49+
50+
// Push NuGet package
51+
eval(`nuget push ${nupkgFile}`)
52+
53+
// Commit changes to project file
54+
eval(`git commit -am "New release: ${version}"`);
55+
56+
// Create release tag
57+
eval(`git tag -a ${version} -m "${notes}"`);
58+
eval(`git push --follow-tags`);
59+
60+
// Create release on GitHub
61+
let response = $(`curl -f -H "Authorization: token ${env.GITHUB_API_TOKEN}" \
62+
-d '{"tag_name":"${version}", "name":"${version}","body":"${notes}","prerelease": ${preRelease}}' \
63+
https://api.github.com/repos/${ghRepo}/releases`
64+
);
65+
66+
let releaseId = JSON.parse(response).id;
67+
68+
// Get the release id and then upload the and upload the .nupkg
69+
eval(`curl -H "Authorization: token ${env.GITHUB_API_TOKEN}" -H "Content-Type: application/octet-stream" \
70+
--data-binary @"${nupkgFile}" \
71+
https://uploads.github.com/repos/${ghRepo}/releases/${releaseId}/assets?name=${nupkgFile}`);
72+
73+
eval(`rm -r ${buildDirectory}`)
74+
75+
echo(`DONE! Released version ${version} to NuGet and GitHub.`);
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
3+
<metadata>
4+
<id>dbup-sqlserver-scripting</id>
5+
<version>$version$</version>
6+
<title>DbUp SQL Server Object Scripting</title>
7+
<authors>Brady Holt</authors>
8+
<owners>Brady Holt</owners>
9+
<licenseUrl>https://raw.github.com/bradyholt/dbup-sqlserver-scripting/master/LICENSE</licenseUrl>
10+
<projectUrl>https://github.com/bradyholt/dbup-sqlserver-scripting</projectUrl>
11+
<iconUrl>https://raw.github.com/DbUp/DbUp/master/src/Information/dbup-icon.png</iconUrl>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13+
<description>Extends DbUp to provide SQL Server object definition scripting when running migrations from Visual Studio. When a database object changes during a migration, its definition will be saved in the project.</description>
14+
<releaseNotes>$notes$</releaseNotes>
15+
<copyright>$copyright$</copyright>
16+
<tags>dbup database migrations sqlserver scripting definitions scripts console</tags>
17+
<dependencies>
18+
<dependency id="dbup" version="3.2.1" />
19+
<dependency id="dbup-consolescripts" version="1.0.9"/>
20+
<dependency id="Unofficial.Microsoft.SQLServer.SMO.2014" version="12.0.2000.8" />
21+
</dependencies>
22+
</metadata>
23+
</package>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<runtime>
4+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentity name="Microsoft.SqlServer.Diagnostics.STrace" publicKeyToken="89845dcd8080cc91" culture="neutral" />
7+
<bindingRedirect oldVersion="0.0.0.0-14.100.0.0" newVersion="14.100.0.0" />
8+
</dependentAssembly>
9+
</assemblyBinding>
10+
</runtime>
11+
</configuration>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<# Package Manager Console scripts to support DbUp #>
2+
3+
function Start-DatabaseScript {
4+
$project = Get-Project
5+
Write-Host "Building..."
6+
$dte.Solution.SolutionBuild.BuildProject("Debug", $project.FullName, $true)
7+
$projectDirectory = Split-Path $project.FullName
8+
$projectExe = $projectDirectory + "\bin\Debug\" + $project.Name + ".exe"
9+
$args = " --scriptAllDefinitions"
10+
11+
& $projectExe $args
12+
}
13+
14+
15+
function New-InitialScript {
16+
17+
$project = get-project
18+
$projectDirectory = Split-Path $project.FullName
19+
#wrap in a job so type isn't locked
20+
$job = Start-Job -ScriptBlock {
21+
$basePath = $args[0]
22+
$binDirectory = "$basePath\bin\debug"
23+
try{
24+
Add-Type -Path "$binDirectory\DbUp.dll"
25+
Add-Type -Path "$binDirectory\DbUp.Support.SqlServer.Scripting.dll"
26+
}
27+
catch
28+
{
29+
Write-Host -foreground yellow "LoadException";
30+
$Error | format-list -force
31+
Write-Host -foreground red $Error[0].Exception.LoaderExceptions;
32+
}
33+
34+
$scriptProvider = new-object DbUp.Support.SqlServer.Scripting.DefinitionScriptProvider -ArgumentList "$basePath\Definitions"
35+
$scriptProvider.GetScriptContent()
36+
} -ArgumentList $projectDirectory
37+
Wait-Job $job
38+
39+
#create scripts folder if it doesn't exist
40+
$scripts = $project.ProjectItems | ?{ $_.Name.Equals("Scripts") }
41+
if($scripts -eq $null){
42+
$project.ProjectItems.AddFolder("Scripts")
43+
}
44+
#Create the new script by calling the lib
45+
$initialScriptPath = "$projectDirectory\Scripts\001-initial.sql"
46+
Receive-Job $job | New-Item $initialScriptPath -Force -ErrorAction Ignore -ItemType file
47+
48+
#add to project
49+
$addedItem = $project.ProjectItems.Item("Scripts").ProjectItems.AddFromFileCopy($initialScriptPath)
50+
#update to embedded resource
51+
$addedItem.Properties.Item("BuildAction").Value = 3
52+
}

tmp/pack/tools/init.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
param($installPath, $toolsPath, $package, $project)
2+
3+
Import-Module (Join-Path $toolsPath dbup-sqlserver-scripting.psm1)

0 commit comments

Comments
 (0)