From 06e39f983856e7505ed7dc654846deef1743fe72 Mon Sep 17 00:00:00 2001
From: Matthias Kollenbroich <matthias.kollenbroich@uni-muenster.de>
Date: Mon, 13 Mar 2023 11:09:52 +0100
Subject: [PATCH] Updated and added moodle-release.yml
---
.github/workflows/moodle-release.yml | 53 ++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
create mode 100644 .github/workflows/moodle-release.yml
diff --git a/.github/workflows/moodle-release.yml b/.github/workflows/moodle-release.yml
new file mode 100644
index 0000000..c269301
--- /dev/null
+++ b/.github/workflows/moodle-release.yml
@@ -0,0 +1,53 @@
+#
+# Whenever a new tag starting with "v" is pushed, add the tagged version
+# to the Moodle Plugins directory at https://moodle.org/plugins
+#
+# 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: filter_opencast
+ 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 "releasenotesformat=4")
+ echo "response=${RESPONSE}" >> $GITHUB_OUTPUT
+ - name: Evaluate the response
+ id: evaluate-response
+ env:
+ RESPONSE: ${{ steps.add-version.outputs.response }}
+ run: |
+ jq <<< ${RESPONSE}
+ jq --exit-status ".id" <<< ${RESPONSE} > /dev/null
--
GitLab