Skip to content

Commit b14083a

Browse files
Mershoaarani
andcommitted
snap_release.fsx: allow version override
A flag called --auto was also added for bypassing the "press any key" in bump.fsx. Co-authored-by: Afshin Arani <[email protected]>
1 parent 05ea761 commit b14083a

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed

.github/workflows/CI.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,11 @@ jobs:
554554
# > error: cannot communicate with server: Post "http://localhost/v2/snaps/snapcraft": dial unix /run/snapd.socket: connect: no such file or directory
555555
- name: HACK to emulate msbuild uninstall
556556
run: sudo rm `which msbuild`
557+
558+
- name: Bump snap version
559+
run: |
560+
git submodule foreach git fetch --all && git submodule sync --recursive && git submodule update --init --recursive
561+
dotnet fsi ./scripts/snap_bump.fsx
557562
558563
- name: Generate snap package
559564
run: |
@@ -570,7 +575,7 @@ jobs:
570575
- uses: actions/upload-artifact@v3
571576
name: Upload snap package as artifact
572577
with:
573-
name: snap
578+
name: snap_beta
574579
path: ./*.snap
575580

576581
- name: Upload snap package to Snap Store

scripts/bump.fsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,17 @@ let IsStable miniVersion =
2121
(int miniVersion % 2) = 0
2222

2323
let args = Misc.FsxOnlyArguments()
24+
25+
let isAuto =
26+
if args |> List.contains "--auto" then
27+
true
28+
else
29+
false
30+
2431
let suppliedVersion =
2532
if args.Length > 0 then
26-
if args.Length > 1 then
27-
Console.Error.WriteLine "Only one argument supported, not more"
33+
if args.Length > 2 then
34+
Console.Error.WriteLine "Only two argument supported, not more"
2835
Environment.Exit 1
2936
failwith "Unreachable"
3037
else
@@ -263,14 +270,19 @@ if not replaceScript.Exists then
263270
GitDiff()
264271

265272
Console.WriteLine "Bumping..."
266-
RunUpdateServers()
273+
if not isAuto then
274+
RunUpdateServers()
267275
let fullUnstableVersion,newFullStableVersion = Bump true
268-
GitCommit fullUnstableVersion newFullStableVersion
269-
GitTag newFullStableVersion
276+
if not isAuto then
277+
GitCommit fullUnstableVersion newFullStableVersion
278+
GitTag newFullStableVersion
270279

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

283+
if isAuto then
284+
Environment.Exit 0
285+
274286
if isReleaseManual then
275287
Console.WriteLine "Release binaries now and press any key when you finish."
276288
Console.ReadKey true |> ignore

scripts/snap_bump.fsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env fsharpi
2+
3+
open System
4+
open System.IO
5+
6+
#if !LEGACY_FRAMEWORK
7+
#r "nuget: Fsdk, Version=0.6.0--date20231031-0834.git-2737eea"
8+
#else
9+
#r "System.Configuration"
10+
open System.Configuration
11+
12+
#load "fsx/Fsdk/Misc.fs"
13+
#load "fsx/Fsdk/Process.fs"
14+
#load "fsx/Fsdk/Git.fs"
15+
#endif
16+
open Fsdk
17+
open Fsdk.Process
18+
19+
#load "fsxHelper.fs"
20+
open GWallet.Scripting
21+
22+
let currentVersion = Misc.GetCurrentVersion(FsxHelper.RootDir)
23+
24+
let newVersion =
25+
Version(currentVersion.Major, currentVersion.Minor + 2, currentVersion.Build + 1, currentVersion.Revision).ToString()
26+
27+
Process.Execute(
28+
{
29+
Command = "dotnet"
30+
Arguments = sprintf "fsi %s %s --auto" (Path.Combine(FsxHelper.ScriptsDir.FullName, "bump.fsx")) newVersion
31+
}, Echo.All
32+
).UnwrapDefault() |> ignore<string>

0 commit comments

Comments
 (0)