Skip to content

Commit

Permalink
snap_release.fsx: allow version override
Browse files Browse the repository at this point in the history
Co-authored-by: Afshin Arani <[email protected]>
  • Loading branch information
Mersho and aarani committed Nov 16, 2023
1 parent 05ea761 commit f344e9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ jobs:
- name: Upload snap package to Snap Store
env:
SNAPCRAFT_LOGIN: ${{ secrets.SNAPCRAFT_LOGIN }}
OVERRIDE_SNAP_VERSION: true
run: |
sudo apt update
./scripts/snap_release.sh beta
13 changes: 13 additions & 0 deletions scripts/snap_release.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,19 @@ let snapPush =
| _ ->
failwith "Invalid arguments"

let overrideVersion = Environment.GetEnvironmentVariable "OVERRIDE_SNAP_VERSION"
if not (String.IsNullOrWhiteSpace overrideVersion) then
let snapcraftDir = Path.Combine(FsxHelper.RootDir.FullName, "snap", "snapcraft.yaml")
let readSnapcraftYaml = File.ReadAllText snapcraftDir
let matchVersion = Regex.Match(readSnapcraftYaml, @"(?<=version:\s')[\d\.]+(?=')")
if matchVersion.Success then
let versionList = matchVersion.Value.Split('.')
Array.set versionList 1 ((int versionList.[1] + 2).ToString())
let newSnapYaml = readSnapcraftYaml.Replace (matchVersion.Value, String.Join(".", versionList))
File.WriteAllText (snapcraftDir, newSnapYaml)
else
failwithf "Snap version not found in: '%s'" snapcraftDir

Process.Execute(
{
Command = "snapcraft"
Expand Down

0 comments on commit f344e9e

Please sign in to comment.