diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index ab3524e..ae04a1c 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -6,21 +6,29 @@ jobs: static: runs-on: ubuntu-latest + outputs: + has_tests: ${{ steps.check_tests.outputs.has_tests }} + strategy: matrix: php: ['7.4'] - moodle-branch: ['MOODLE_311_STABLE'] + moodle-branch: ['MOODLE_400_STABLE'] database: ['pgsql'] steps: - name: Start PostgreSQL - run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6 + run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10 - name: Check out repository code uses: actions/checkout@v2 with: path: plugin + - name: Check for test folder + id: check_tests + run: | + echo "::set-output name=has_tests::${{ hashFiles('plugin/tests') != '' }}" + - name: Setup PHP ${{ matrix.php }} uses: shivammathur/setup-php@v2 with: @@ -101,22 +109,23 @@ jobs: test: runs-on: ubuntu-latest needs: static + if: ${{ needs.static.outputs.has_tests == 'true' }} strategy: fail-fast: false matrix: - php: ['7.3', '7.4'] - moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE'] + php: ['7.4'] + moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE', 'MOODLE_400_STABLE'] database: ['mariadb', 'pgsql'] steps: - name: Start MariaDB if: matrix.database == 'mariadb' - run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10.5 + run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10 - name: Start PostgreSQL if: matrix.database == 'pgsql' - run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6 + run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10 - name: Check out repository code uses: actions/checkout@v2 diff --git a/.github/workflows/moodle-release.yml b/.github/workflows/moodle-release.yml new file mode 100644 index 0000000..0da1298 --- /dev/null +++ b/.github/workflows/moodle-release.yml @@ -0,0 +1,54 @@ +# +# Whenever a new tag starting with "v" is pushed, add the tagged version +# to the Moodle Plugins directory at https://moodle.org/plugins +# +# revision: 2021070201 +# Changed to be released on Github release with the release notes. +# +name: Releasing in the Plugins directory + +on: + release: + types: [published] + +defaults: + run: + shell: bash + +jobs: + release-at-moodle-org: + runs-on: ubuntu-latest + env: + PLUGIN: block_qrcode + CURL: curl -s + ENDPOINT: https://moodle.org/webservice/rest/server.php + TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }} + FUNCTION: local_plugins_add_version + + steps: + - name: Call the service function + id: add-version + run: | + TAGNAME="${{ github.event.release.tag_name }}" + BODY="${{ github.event.release.body }}" + ZIPURL="${{ github.event.release.zipball_url }}" + RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \ + --data-urlencode "wsfunction=${FUNCTION}" \ + --data-urlencode "moodlewsrestformat=json" \ + --data-urlencode "frankenstyle=${PLUGIN}" \ + --data-urlencode "zipurl=${ZIPURL}" \ + --data-urlencode "vcssystem=git" \ + --data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \ + --data-urlencode "vcstag=${TAGNAME}" \ + --data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \ + --data-urlencode "altdownloadurl=${ZIPURL}" \ + --data-urlencode "releasenotes=${BODY}" \ + --data-urlencode "releaseformat=4") + echo "::set-output name=response::${RESPONSE}" + - name: Evaluate the response + id: evaluate-response + env: + RESPONSE: ${{ steps.add-version.outputs.response }} + run: | + jq <<< ${RESPONSE} + jq --exit-status ".id" <<< ${RESPONSE} > /dev/null diff --git a/version.php b/version.php index 5107c0f..91bcbb7 100644 --- a/version.php +++ b/version.php @@ -25,6 +25,6 @@ $plugin->component = 'block_qrcode'; // Full name of the plugin. $plugin->maturity = MATURITY_STABLE; -$plugin->release = 'v3.10-r1'; -$plugin->version = 2020111700; // The current plugin version (Date: YYYMMDDXX). -$plugin->requires = 2017050500; // Requires this Moodle version. +$plugin->release = 'v4.0-r1'; +$plugin->version = 2022040400; // The current plugin version (Date: YYYMMDDXX). +$plugin->requires = 2020061500; // Requires Moodle 3.9+.