Skip to content

Commit 5db7bfd

Browse files
committed
CI,scripts: upload MAUI snap to snap store
Upload alpha (MAUI) snap package to snap store.
1 parent 3e592c2 commit 5db7bfd

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

.github/workflows/CI.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,3 +720,10 @@ jobs:
720720
with:
721721
name: snap_alpha
722722
path: ./*.snap
723+
724+
- name: Upload snap package to Snap Store
725+
env:
726+
SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}}
727+
run: |
728+
sudo apt update
729+
./scripts/snap_release.sh edge

scripts/snap_release.fsx

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,22 @@ if gitProvider = GitLab then
8787

8888
Console.WriteLine "Checking if this is a tag commit..."
8989

90+
let isEdge =
91+
match Misc.FsxOnlyArguments() with
92+
| "edge" :: _ -> true
93+
| _ -> false
94+
9095
let gitTag =
9196
match gitProvider with
9297
| GitHub ->
9398
let tagsPrefix = "refs/tags/"
9499
if not (githubRef.StartsWith tagsPrefix) then
95-
Console.WriteLine (sprintf "No tag being set (GITHUB_REF=%s), skipping release." githubRef)
96-
Environment.Exit 0
97-
githubRef.Substring tagsPrefix.Length
100+
if not isEdge then
101+
Console.WriteLine (sprintf "No tag being set (GITHUB_REF=%s), skipping release." githubRef)
102+
Environment.Exit 0
103+
None
104+
else
105+
Some(githubRef.Substring tagsPrefix.Length)
98106

99107
| GitLab ->
100108
let commitHash = Git.GetLastCommit()
@@ -103,23 +111,23 @@ let gitTag =
103111
failwith "CI_COMMIT_REF_NAME should be available when GitLab: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html"
104112

105113
let ciTag = Environment.GetEnvironmentVariable "CI_COMMIT_TAG"
106-
if String.IsNullOrEmpty ciTag then
114+
if String.IsNullOrEmpty ciTag && not isEdge then
107115
Console.WriteLine (sprintf "No tag being set (CI_COMMIT_TAG=%s), skipping release." ciTag)
108116
Environment.Exit 0
109117

110118
failwith "GitLab not supported at the moment for Snap release process"
111119

112-
ciTag
120+
Some ciTag
113121

114122
let channel =
115-
match Misc.FsxOnlyArguments() with
116-
| [ channel ] ->
123+
match Misc.FsxOnlyArguments(), gitTag with
124+
| [ channel ], _ ->
117125
channel
118-
| [] ->
126+
| [], Some tag ->
119127

120-
if not (snapFile.FullName.Contains gitTag) then
128+
if not (snapFile.FullName.Contains tag) then
121129
failwithf "Git tag (%s) doesn't match version in snap package file name (%s)"
122-
gitTag
130+
tag
123131
snapFile.FullName
124132

125133
// the 'stable' and 'candidate' channels require 'stable' grade in the yaml
@@ -150,16 +158,19 @@ else
150158
// this must be a fork, do nothing
151159
Console.WriteLine "snapcraft.login file not found in likely GitLab fork repo, skipping log-in"
152160

153-
Console.WriteLine (sprintf "About to start upload of release %s" gitTag)
161+
Console.WriteLine (sprintf "About to start upload of release %s" (gitTag |> Option.defaultValue channel))
154162

155163
let loginMsgAdvice =
156164
"There was a problem trying to login with snapcraft, maybe the credentials expired?\r\n" +
157165
"If that is the case, install it in the same way as in install_snapcraft.sh and perform 'snapcraft export-login snapcraft.login', then extract the contents of 'snapcraft.login' file"
158166

159-
Process.Execute({ Command = "snapcraft"; Arguments = "login --with snapcraft.login" }, Echo.All)
160-
.Unwrap(loginMsgAdvice) |> ignore<string>
167+
if not isEdge then
168+
Process.Execute({ Command = "snapcraft"; Arguments = "login --with snapcraft.login" }, Echo.All)
169+
.Unwrap(loginMsgAdvice) |> ignore<string>
161170

162-
Console.WriteLine "Login successfull. Upload starting..."
171+
Console.WriteLine "Login sucessful. Upload starting..."
172+
else
173+
Console.WriteLine "Upload starting..."
163174

164175
let snapPush =
165176
Process.Execute(

0 commit comments

Comments
 (0)