From 86e0677565040df5a04943a9b1c1ab9ec6a1c18d Mon Sep 17 00:00:00 2001 From: Glutamat42 Date: Sat, 14 Dec 2024 16:40:30 +0100 Subject: [PATCH] remove: dynamically creating list of supported moodle versions depending on the plugin requirements --- .github/workflows/release.yml | 17 +-------- get_supported_moodle_versions.sh | 63 -------------------------------- 2 files changed, 2 insertions(+), 78 deletions(-) delete mode 100644 get_supported_moodle_versions.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4569905..61181a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,19 +5,6 @@ on: types: [ created ] jobs: - define-matrix: - runs-on: ubuntu-latest - outputs: - include_list: ${{ steps.moodle_versions.outputs.moodle_versions }} - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Collect list of compatible moodle versions - id: moodle_versions - run: | - supported_versions=$(bash get_supported_moodle_versions.sh) - echo "moodle_versions=$supported_versions" >> $GITHUB_OUTPUT - release: runs-on: ubuntu-latest needs: define-matrix @@ -25,7 +12,7 @@ jobs: contents: write strategy: matrix: - moodle_version: ${{ fromJSON(needs.define-matrix.outputs.include_list) }} + moodle_version: [ '4.4', '4.5' ] steps: - name: Build Docker image uses: docker/build-push-action@v2 @@ -34,7 +21,7 @@ jobs: build-args: | MOODLE_VERSION=${{ matrix.moodle_version }} file: Dockerfile - push: false + push: true tags: adler-moodle:${{ matrix.moodle_version }}-${{ github.event.release.tag_name }} # diff --git a/get_supported_moodle_versions.sh b/get_supported_moodle_versions.sh deleted file mode 100644 index e3f5dc2..0000000 --- a/get_supported_moodle_versions.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# Read plugins.json -plugins=$(jq -c '.[]' plugins.json) - -# Initialize the supported_moodle_versions variable -supported_moodle_versions="" - -# Iterate over each plugin -for plugin in $plugins; do - git_project=$(echo $plugin | jq -r '.git_project') - version=$(echo $plugin | jq -r '.version') - name=$(echo $plugin | jq -r '.name') - - # Construct the URL to the plugin_compatibility.json file - if [ "$version" == "main" ]; then - url="https://raw.githubusercontent.com/$git_project/refs/heads/$version/plugin_compatibility.json" - else - url="https://raw.githubusercontent.com/$git_project/refs/tags/$version/plugin_compatibility.json" - fi - - # Fetch the plugin_compatibility.json file - response=$(curl -s $url) - - if [[ "$response" == "404: Not Found" ]]; then - echo "Failed to fetch plugin_compatibility.json for $name ($version)" - exit 1 - fi - - # Extract the list of Moodle versions from the response - current_moodle_versions=$(echo $response | jq -r '.[].moodle') - if [ $? -eq 0 ]; then - if [ -z "$supported_moodle_versions" ]; then - # If supported_moodle_versions is empty, set it to the current list - supported_moodle_versions=$current_moodle_versions - else - # Otherwise, keep only the versions that are in both lists - supported_moodle_versions=$(echo "$supported_moodle_versions" | grep -Fxf - <(echo "$current_moodle_versions")) - fi - else - echo "Failed to fetch plugin_compatibility.json for $name ($version)" - exit 1 - fi -done - -convert_branch_to_version() { - branch_name=$1 - major_version=${branch_name:7:1} - minor_version=${branch_name:8:2} - minor_version=${minor_version#0} # Remove leading zero if present - echo "$major_version.$minor_version" -} - -json_array="[" -for moodle_branch in $supported_moodle_versions; do - moodle_version=$(convert_branch_to_version $moodle_branch) - json_array="$json_array {\"moodle\": \"$moodle_version\"}," -done -json_array="${json_array%,} ]" - - -# Output the final list of supported Moodle versions -echo "$json_array" \ No newline at end of file