From b3c46680896bb06a1ff58b0a500e1bf69fb3eb8e Mon Sep 17 00:00:00 2001 From: Paul Kendall Date: Thu, 7 Sep 2023 10:11:51 +1200 Subject: [PATCH] Auto generate valid versions from artefact repository --- .github/workflows/web.yml | 10 +++++++--- src/js/index.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 65af696..fa1c56d 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -25,22 +25,26 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Build - run: npm install && npm run dist - name: Get supported target version artifacts run: | + mkdir -p dist cd dist mkdir firmware cd firmware curl -L -o index.json https://artifactory.expresslrs.org/ExpressLRS/index.json - for i in 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.3.0 ; do + for i in `cat index.json | jq '.tags | keys[]' | grep -v -- -RC | sed 's/"//g' | sort -r` ; do HASH=`grep \"$i\" index.json | sed 's/.* "//' | sed 's/".*//'` curl -L -o firmware.zip "https://artifactory.expresslrs.org/ExpressLRS/$HASH/firmware.zip" unzip firmware.zip rm firmware.zip mv firmware $i + VERSIONS=$VERSIONS", '$i'" done rm -f index.json + VERSIONS=`echo $VERSIONS|sed 's/, //'` + sed -i~ "s/\'@VERSIONS@\'/$VERSIONS/" ../../src/js/index.js + - name: Build + run: npm install && npm run dist - name: Setup Pages if: ${{ github.ref == 'refs/heads/master' }} uses: actions/configure-pages@v1 diff --git a/src/js/index.js b/src/js/index.js index 6c95ebb..a015ecd 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -8,7 +8,7 @@ import { SwalMUI, Toast } from './swalmui.js' import FileSaver from 'file-saver' import mui from 'muicss' -const versions = ['3.3.0', '3.2.1', '3.2.0', '3.1.2', '3.1.1', '3.1.0', '3.0.1', '3.0.0'] +const versions = ['@VERSIONS@'] const versionSelect = _('version') const flashMode = _('flash-mode') const flashButton = _('flashButton')