diff --git a/scripts/snap-build.ps1 b/scripts/snap-build.ps1 new file mode 100644 index 0000000000..0513572902 --- /dev/null +++ b/scripts/snap-build.ps1 @@ -0,0 +1,25 @@ +# To run: +# ./snap-build.ps1 +# +# and then push to snap with: +# cd ../dist/snap +# snap push bw*.snap + +$dir = Split-Path -Parent $MyInvocation.MyCommand.Path +$rootDir = $dir + "/.." +$distDir = $rootDir + "/dist" +$snapDir = $rootDir + "/stores/snap" +$distSnapDir = $distDir + "/snap" +$snapYaml = $snapDir + "/snapcraft.yaml" +$snapDistYaml = $distSnapDir + "/snapcraft.yaml" +$srcPackage = $rootDir + "/package.json" +$srcPackageVersion = (Get-Content -Raw -Path $srcPackage | ConvertFrom-Json).version + +if(Test-Path -Path $distSnapDir) { + Remove-Item -Recurse -Force $distSnapDir +} + +Copy-Item -Path $snapDir -Destination $distSnapDir –Recurse +(Get-Content $snapDistYaml).replace('__version__', $srcPackageVersion) | Set-Content $snapDistYaml +cd $distSnapDir +snapcraft diff --git a/stores/snap/snapcraft.yaml b/stores/snap/snapcraft.yaml index fe2e5c740b..8d37574ad4 100644 --- a/stores/snap/snapcraft.yaml +++ b/stores/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: bw -version: 1.0.0 +version: __version__ summary: Bitwarden CLI description: A secure and free password manager for all of your devices. confinement: strict @@ -12,4 +12,4 @@ parts: plugin: dump source: https://github.com/bitwarden/cli/releases/download/v$SNAPCRAFT_PROJECT_VERSION/bw-linux-$SNAPCRAFT_PROJECT_VERSION.zip prepare: | - chmod +x bw \ No newline at end of file + chmod +x bw