diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml index 88899f35..7e2c2837 100644 --- a/.github/workflows/release-app.yml +++ b/.github/workflows/release-app.yml @@ -8,8 +8,21 @@ on: branches: ["*"] jobs: + define-matrix: + runs-on: ubuntu-latest + outputs: + nextcloud_versions: ${{ steps.get-matrix.outputs.nextcloud_versions }} + steps: + - uses: actions/checkout@v4 + - id: get-matrix + run: echo "nextcloud_versions=$(./get-matrix.sh)" | tee -a "$GITHUB_OUTPUT" + test: runs-on: ubuntu-latest + needs: define-matrix + strategy: + matrix: + nextcloud_version: ${{fromJson(needs.define-matrix.outputs.nextcloud_versions)}} steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -34,7 +47,7 @@ jobs: env: CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }} CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }} - run: ./install.sh + run: ./install.sh ${{ matrix.nextcloud_version }} - name: run tests env: diff --git a/get-matrix.sh b/get-matrix.sh new file mode 100755 index 00000000..532f7754 --- /dev/null +++ b/get-matrix.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +MIN_VERSION=$([[ $(cat appinfo/info.xml) =~ $(echo ']*min-version=[^[0-9]]*([0-9]+).*') ]] && echo ${BASH_REMATCH[1]}) +MAX_VERSION=$([[ $(cat appinfo/info.xml) =~ $(echo ']*max-version=[^[0-9]]*([0-9]+).*') ]] && echo ${BASH_REMATCH[1]}) + +[ -z "$MIN_VERSION" ] && [ -z "$MAX_VERSION" ] && echo 'A version constraint should be set' && exit 1 + +MIN_VERSION=${MIN_VERSION:-$MAX_VERSION} +MAX_VERSION=${MAX_VERSION:-$MIN_VERSION} + +[ "$MIN_VERSION" -gt "$MAX_VERSION" ] && echo 'Min version should be less or equal to max version' && exit 1 + +echo "[$(echo "\"$(seq -s '","' $MIN_VERSION $MAX_VERSION)\"")]" + diff --git a/install.sh b/install.sh index 0933322b..38bc2161 100755 --- a/install.sh +++ b/install.sh @@ -1,12 +1,14 @@ #!/bin/bash +NEXTCLOUD_VERSION=${1:-29} + source .env-local || echo "No .env-local file found." setup_nextcloud () { echo "setup nextcloud" docker stop nextcloud-container || echo "No container to stop" sleep 1 - docker run -d --name nextcloud-container --rm --publish 80:80 nextcloud:29 + docker run -d --name nextcloud-container --rm --publish 80:80 nextcloud:$NEXTCLOUD_VERSION until docker exec --user www-data -i nextcloud-container php occ status | grep "installed: false" do