From 244c02c5ea13b8bb9ce336d3398b623f997a9d25 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 26 Jun 2020 14:12:37 +0200 Subject: [PATCH] Deploy new snap on release --- .github/workflows/deploy.yml | 24 +++++++++++++++++++++++- snap/local/svc_wrapper.sh | 2 +- snap/snapcraft.yaml | 12 +++++++----- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cd90eba..75a566b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,7 +5,7 @@ on: types: [published] jobs: - build: + npm: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -14,3 +14,25 @@ jobs: - run: npm publish --access public env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + snap: + runs-on: ubuntu-latest + container: snapcore/snapcraft + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + - run: npm install + - run: ./utils/use_require.js --clean --as commonjs --with-app + - run: | + cp utils/launch.sh build/launch.sh + cp snap/local/svc_wrapper.sh build/svc_wrapper.sh + - run: | + VERSION=$(grep '"version"' package.json | cut -d '"' -f 4) + echo $VERSION + sed -i "s/@VERSION@/$VERSION/g" snap/snapcraft.yaml + - run: snapcraft + - run: | + mkdir .snapcraft + echo ${SNAPCRAFT_LOGIN} | base64 --decode --ignore-garbage > .snapcraft/snapcraft.cfg + env: + SNAPCRAFT_LOGIN: ${{secrets.SNAPCRAFT_LOGIN}} + - run: snapcraft push --release=stable *.snap diff --git a/snap/local/svc_wrapper.sh b/snap/local/svc_wrapper.sh index 51d7464..7b0be23 100755 --- a/snap/local/svc_wrapper.sh +++ b/snap/local/svc_wrapper.sh @@ -24,6 +24,6 @@ snapctl get services | jq -c '.[]' | while read service; do # for each service t echo "novnc: not starting service ${service} with listen_port ${listen_port} and vnc_host_port ${vnc_host_port}" else # start (and fork with '&') the service using the specified listen port and VNC host:port - $SNAP/utils/launch.sh --listen $listen_port --vnc $vnc_host_port & + $SNAP/launch.sh --listen $listen_port --vnc $vnc_host_port & fi done diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 2549c05..d1bb9dc 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,17 +1,19 @@ name: novnc base: core18 # the base snap is the execution environment for this snap -version: '1.1.0' +version: '@VERSION@' summary: Open Source VNC client using HTML5 (WebSockets, Canvas) description: | Open Source VNC client using HTML5 (WebSockets, Canvas). - noVNC is both a VNC client JavaScript library as well as an application built on top of that library. noVNC runs well in any modern browser including mobile browsers (iOS and Android). + noVNC is both a VNC client JavaScript library as well as an + application built on top of that library. noVNC runs well in any + modern browser including mobile browsers (iOS and Android). grade: stable confinement: strict parts: novnc: - source: https://github.com/novnc/noVNC.git #https://github.com/novnc/noVNC/archive/v$SNAPCRAFT_PROJECT_VERSION.tar.gz + source: build/ plugin: dump stage-packages: - websockify @@ -26,9 +28,9 @@ hooks: apps: novnc: - command: utils/launch.sh + command: ./launch.sh plugs: [network, network-bind] novncsvc: - command: snap/local/svc_wrapper.sh + command: ./svc_wrapper.sh daemon: forking plugs: [network, network-bind] -- 2.39.2