Skip to content

Commit 635b224

Browse files
author
Matthias Kollenbroich
committed
Updated and added moodle-release.yml
1 parent ba72383 commit 635b224

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/moodle-release.yml

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

0 commit comments

Comments
 (0)