Skip to content

Commit

Permalink
build script that publishes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Tolmachev committed May 19, 2017
1 parent fc8da02 commit a11b9a2
Show file tree
Hide file tree
Showing 7 changed files with 493 additions and 196 deletions.
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if errorlevel 1 (
exit /b %errorlevel%
)

packages\FAKE\tools\FAKE.exe build.fsx %*
packages\build\FAKE\tools\FAKE.exe build.fsx %*
48 changes: 30 additions & 18 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// include Fake libs
#r "./packages/FAKE/tools/FakeLib.dll"
#r "./packages/build/FAKE/tools/FakeLib.dll"
#r "System.IO.Compression.FileSystem"

open System
open System.IO
open Fake
open Fake.NpmHelper
open Fake.Git


let yarn =
if EnvironmentHelper.isWindows then "yarn.cmd" else "yarn"
Expand All @@ -14,16 +16,14 @@ let yarn =
| Some yarn -> yarn
| ex -> failwith ( sprintf "yarn not found (%A)\n" ex )

// Directories
let buildDir = "./build/"
let gitName = "sample-react-counter"
let gitOwner = "fable-elmish"
let gitHome = sprintf "https://github.com/%s" gitOwner

// Filesets
let projects =
!! "src/*.fsproj"
!! "src/**.fsproj"

// Artifact packages
let packages =
!! "src/package.json"

let dotnetcliVersion = "1.0.1"
let mutable dotnetExePath = "dotnet"
Expand Down Expand Up @@ -90,9 +90,6 @@ Target "InstallDotNetCore" (fun _ ->
|> Seq.iter (fun path -> tracefn " - %s%c" path System.IO.Path.DirectorySeparatorChar)

dotnetExePath <- dotnetSDKPath </> (if isWindows then "dotnet.exe" else "dotnet")

// let oldPath = System.Environment.GetEnvironmentVariable("PATH")
// System.Environment.SetEnvironmentVariable("PATH", sprintf "%s%s%s" dotnetSDKPath (System.IO.Path.PathSeparator.ToString()) oldPath)
)


Expand All @@ -111,25 +108,40 @@ Target "Install" (fun _ ->
)
)


// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir]
)

Target "Build" (fun _ ->
projects
|> Seq.iter (fun s ->
let dir = IO.Path.GetDirectoryName s
runDotnet dir "fable npm-run build")
)

// --------------------------------------------------------------------------------------
// Release Scripts

Target "ReleaseSample" (fun _ ->
let tempDocsDir = "temp/gh-pages"
CleanDir tempDocsDir
Repository.cloneSingleBranch "" (gitHome + "/" + gitName + ".git") "gh-pages" tempDocsDir

CopyRecursive "src/public" tempDocsDir true |> tracefn "%A"
["src/index.html"] |> CopyFiles tempDocsDir

StageAll tempDocsDir
Git.Commit.Commit tempDocsDir (sprintf "Update generated sample")
Branches.push tempDocsDir
)

Target "Publish" DoNothing

// Build order
"Clean"
==> "InstallDotNetCore"
"InstallDotNetCore"
==> "Install"
==> "Build"

"Publish"
<== [ "Build"
"ReleaseSample" ]


// start build
RunTargetOrDefault "Build"
6 changes: 2 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
if test "$OS" = "Windows_NT"
then
# use .Net

.paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi

packages/FAKE/tools/FAKE.exe $@ --fsiargs build.fsx
packages/build/FAKE/tools/FAKE.exe $@ --fsiargs build.fsx
else
# use mono

mono .paket/paket.exe restore
exit_code=$?
if [ $exit_code -ne 0 ]; then
exit $exit_code
fi
mono packages/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
mono packages/build/FAKE/tools/FAKE.exe $@ --fsiargs -d:MONO build.fsx
fi
13 changes: 11 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
source https://nuget.org/api/v2

nuget FAKE
nuget FSharp.Core
nuget FSharp.Core redirects:force, content:none
nuget Fable.Core
nuget Fable.React
nuget Fable.Elmish
nuget Fable.Elmish.React
nuget Fable.Compiler

group Build
framework: net46

source https://nuget.org/api/v2
nuget FSharp.Core redirects:force, content:none
nuget FAKE
Loading

0 comments on commit a11b9a2

Please sign in to comment.