]> Nishi Git Mirror - gwion.git/commitdiff
Use released Gwion
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 21 Sep 2020 23:00:22 +0000 (01:00 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 21 Sep 2020 23:00:22 +0000 (01:00 +0200)
.github/workflows/build.yml
scripts/update.sh [new file with mode: 0644]

index 62a6e1c1fbc32ff0348d618f50651b2ce5cf1159..dcc78576716ac7f6ca00d203cf99bfb5bb26838a 100644 (file)
@@ -37,28 +37,8 @@ jobs:
         git checkout master
         make
 
-    - uses: actions/cache@v1
-      name: Gwion [ cache ]
-      id: gwion-bin
-      with:
-        path: Gwion
-        key: ${{ runner.os }}-gwion
-
     - name: Gwion
-      if: steps.gwion-bin.outputs.cache-hit != 'true'
-      uses: fennecdjay/gwion-action@v1
-
-    - name: Gwion [ update ]
-      if: steps.gwion-bin.outputs.cache-hit == 'true'
-      run: |
-        cd Gwion
-        if [ $(git rev-parse HEAD) != $(git ls-remote https://github.com/fennecdjay/Gwion.git HEAD | cut -f1) ]
-        then
-          git pull
-          git submodule update util ast
-          make
-        fi
-        cp gwion ..
+      run: bash scripts/update.sh
 
     - uses: fennecdjay/emojify-docker-action@v2
       name: Emojify
diff --git a/scripts/update.sh b/scripts/update.sh
new file mode 100644 (file)
index 0000000..f80acca
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+get_latest_release() {
+  curl --silent "https://api.github.com/repos/$1/$2/releases/latest" | # Get latest release from GitHub api
+    grep '"tag_name":' |                                            # Get tag line
+    sed -E 's/.*"([^"]+)".*/\1/'                                    # Pluck JSON value
+}
+
+update() {
+  new_release=$(get_latest_release $1 $2)
+  url=https://github.com/$1/$2/releases/download
+  file=linux.tar.gz
+  wget "$url/$new_release/$file"
+  tar -zxvf $file
+  rm $file
+}
+
+update fennecdjay Gwion