From b838963b3cbeab74c7160d9cdcb07847ded4087d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 22 Sep 2020 01:00:22 +0200 Subject: [PATCH] Use released Gwion --- .github/workflows/build.yml | 22 +--------------------- scripts/update.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 scripts/update.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62a6e1c1..dcc78576 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 index 00000000..f80accac --- /dev/null +++ b/scripts/update.sh @@ -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 -- 2.43.0