Skip to content

Commit

Permalink
snap_release.fsx: allow version override
Browse files Browse the repository at this point in the history
A flag called --auto was also added for bypassing the
"press any key" in bump.fsx.

Co-authored-by: Afshin Arani <[email protected]>
  • Loading branch information
Mersho and aarani committed Nov 20, 2023
1 parent 05ea761 commit b14083a
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,11 @@ jobs:
# > error: cannot communicate with server: Post "http://localhost/v2/snaps/snapcraft": dial unix /run/snapd.socket: connect: no such file or directory
- name: HACK to emulate msbuild uninstall
run: sudo rm `which msbuild`

- name: Bump snap version
run: |
git submodule foreach git fetch --all && git submodule sync --recursive && git submodule update --init --recursive
dotnet fsi ./scripts/snap_bump.fsx
- name: Generate snap package
run: |
Expand All @@ -570,7 +575,7 @@ jobs:
- uses: actions/upload-artifact@v3
name: Upload snap package as artifact
with:
name: snap
name: snap_beta
path: ./*.snap

- name: Upload snap package to Snap Store
Expand Down
22 changes: 17 additions & 5 deletions scripts/bump.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ let IsStable miniVersion =
(int miniVersion % 2) = 0

let args = Misc.FsxOnlyArguments()

let isAuto =
if args |> List.contains "--auto" then
true
else
false

let suppliedVersion =
if args.Length > 0 then
if args.Length > 1 then
Console.Error.WriteLine "Only one argument supported, not more"
if args.Length > 2 then
Console.Error.WriteLine "Only two argument supported, not more"
Environment.Exit 1
failwith "Unreachable"
else
Expand Down Expand Up @@ -263,14 +270,19 @@ if not replaceScript.Exists then
GitDiff()

Console.WriteLine "Bumping..."
RunUpdateServers()
if not isAuto then
RunUpdateServers()
let fullUnstableVersion,newFullStableVersion = Bump true
GitCommit fullUnstableVersion newFullStableVersion
GitTag newFullStableVersion
if not isAuto then
GitCommit fullUnstableVersion newFullStableVersion
GitTag newFullStableVersion

Console.WriteLine (sprintf "Version bumped to %s."
(newFullStableVersion.ToString()))

if isAuto then
Environment.Exit 0

if isReleaseManual then
Console.WriteLine "Release binaries now and press any key when you finish."
Console.ReadKey true |> ignore
Expand Down
32 changes: 32 additions & 0 deletions scripts/snap_bump.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env fsharpi

open System
open System.IO

#if !LEGACY_FRAMEWORK
#r "nuget: Fsdk, Version=0.6.0--date20231031-0834.git-2737eea"
#else
#r "System.Configuration"
open System.Configuration

#load "fsx/Fsdk/Misc.fs"
#load "fsx/Fsdk/Process.fs"
#load "fsx/Fsdk/Git.fs"
#endif
open Fsdk
open Fsdk.Process

#load "fsxHelper.fs"
open GWallet.Scripting

let currentVersion = Misc.GetCurrentVersion(FsxHelper.RootDir)

let newVersion =
Version(currentVersion.Major, currentVersion.Minor + 2, currentVersion.Build + 1, currentVersion.Revision).ToString()

Process.Execute(
{
Command = "dotnet"
Arguments = sprintf "fsi %s %s --auto" (Path.Combine(FsxHelper.ScriptsDir.FullName, "bump.fsx")) newVersion
}, Echo.All
).UnwrapDefault() |> ignore<string>

0 comments on commit b14083a

Please sign in to comment.