Skip to content

Commit 49c579c

Browse files
committed
Add build scripts for the Snap package
1 parent fc56001 commit 49c579c

File tree

5 files changed

+45
-8
lines changed

5 files changed

+45
-8
lines changed

.github/CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,22 @@ Know how to fix something? We love pull requests! Here's a quick guide:
3434
3. Push the change (we recommend using a separate branch for your feature).
3535
4. Open a pull request.
3636
5. We try to merge and deploy changes as soon as possible, or at least leave some feedback, but if you haven't heard back from us after a couple of days, feel free to leave a comment on the pull request.
37+
38+
## Tips
39+
40+
- When working on Windows, but moving or adding a Linux Bash script, you must make sure the script is executable on Linux:
41+
```bash
42+
# Check file permissions:
43+
$ git ls-files --stage
44+
...
45+
100644 7f4552c7ac8f30e8b5cb5047f03a5969ee61344b 0 build/build.sh
46+
...
47+
# The "100644" must be "100755"
48+
# Make file executable:
49+
$ git update-index --chmod=+x 'build-snap-with-docker.sh'
50+
# Check again:
51+
$ git ls-files --stage
52+
...
53+
100755 7f4552c7ac8f30e8b5cb5047f03a5969ee61344b 0 build/build.sh
54+
...
55+
```

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ serve.exe
2424
/build/artifacts
2525

2626
# Visual Studio Code debug files
27-
debug
27+
debug
28+
29+
# Snap build
30+
/parts
31+
/prime
32+
/stage
33+
/snap/.snapcraft
34+
/*.snap

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,16 @@ To build with a Docker container:
154154

155155
For Scoop and Homebrew no packages need to be built. They use "manifests"/"formulae" and the binaries from GitHub Releases.
156156

157-
For Snap a Git hook is set up in the Snapcraft dashboard to automatically build a new Snap on every commit, but the package can also be built manually with:
157+
For releasing a new version, they need to be updated here:
158158

159-
`snapcraft`
159+
- Scoop: https://github.com/lukesampson/scoop-extras/blob/master/serve.json
160+
- Homebrew: https://github.com/philippgille/homebrew-tap/blob/master/serve.rb
160161

161-
Or when Snapcraft isn't installed, but Docker is:
162+
For Snap a Git hook is set up in the Snapcraft dashboard to automatically build a new Snap on every commit, so for releasing a new version the file in *this* repository needs to be updated:
162163

163-
`docker run --rm -v ${pwd}:/build/serve -w /build/serve snapcraft/xenial-amd64 snapcraft`
164+
- Snap: https://github.com/philippgille/serve/blob/master/snap/snapcraft.yaml
164165

165-
To release the snap into the public Snap channels:
166+
The Snap package can also be built manually, for example with this Bash script which utilizes Docker:
166167

167-
`snapcraft login`
168-
`snapcraft push serve_0.2.0_amd64.snap --release`
168+
- Windows: `build\build-snap-with-docker.ps1`
169+
- Linux: `build/build-snap-with-docker.sh`

build/build-snap-with-docker.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
docker run --rm -v ${PSScriptRoot}\..\:/build/serve -w /build/serve snapcraft/xenial-amd64 snapcraft

build/build-snap-with-docker.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
7+
docker run --rm -v ${SCRIPTDIR}/../:/build/serve -w /build/serve snapcraft/xenial-amd64 snapcraft

0 commit comments

Comments
 (0)