1+ #
2+ # Whenever a new tag starting with "v" is pushed, add the tagged version
3+ # to the Moodle Plugins directory at https://moodle.org/plugins
4+ #
5+ # revision: 2021070201
6+ # Changed to be released on Github release with the release notes.
7+ #
8+ name : Releasing in the Plugins directory
9+
10+ on :
11+ release :
12+ types : [published]
13+
14+ defaults :
15+ run :
16+ shell : bash
17+
18+ jobs :
19+ release-at-moodle-org :
20+ runs-on : ubuntu-latest
21+ env :
22+ PLUGIN : mod_groupmembers
23+ CURL : curl -s
24+ ENDPOINT : https://moodle.org/webservice/rest/server.php
25+ TOKEN : ${{ secrets.MOODLE_ORG_TOKEN }}
26+ FUNCTION : local_plugins_add_version
27+
28+ steps :
29+ - name : Call the service function
30+ id : add-version
31+ run : |
32+ TAGNAME="${{ github.event.release.tag_name }}"
33+ BODY="${{ github.event.release.body }}"
34+ ZIPURL="${{ github.event.release.zipball_url }}"
35+ RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
36+ --data-urlencode "wsfunction=${FUNCTION}" \
37+ --data-urlencode "moodlewsrestformat=json" \
38+ --data-urlencode "frankenstyle=${PLUGIN}" \
39+ --data-urlencode "zipurl=${ZIPURL}" \
40+ --data-urlencode "vcssystem=git" \
41+ --data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
42+ --data-urlencode "vcstag=${TAGNAME}" \
43+ --data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
44+ --data-urlencode "altdownloadurl=${ZIPURL}" \
45+ --data-urlencode "releasenotes=${BODY}" \
46+ --data-urlencode "releasenotesformat=4")
47+ echo "::set-output name=response::${RESPONSE}"
48+ - name : Evaluate the response
49+ id : evaluate-response
50+ env :
51+ RESPONSE : ${{ steps.add-version.outputs.response }}
52+ run : |
53+ jq <<< ${RESPONSE}
54+ jq --exit-status ".id" <<< ${RESPONSE} > /dev/null
0 commit comments