Browse Source

add github action for moodle plugin release.

40-behatfixes
Dan Marsden 3 years ago
parent
commit
b5d76a428a
  1. 51
      .github/workflows/moodle-release.yml

51
.github/workflows/moodle-release.yml

@ -0,0 +1,51 @@
#
# Whenever version.php is changed, add the latest version
# to the Moodle Plugins directory at https://moodle.org/plugins
#
# revision: 2021070201
#
name: Releasing in the Plugins directory
on:
push:
paths:
- '/version.php'
defaults:
run:
shell: bash
jobs:
release-at-moodle-org:
runs-on: ubuntu-latest
env:
PLUGIN: mod_attendance
BRANCH: MOODLE_311_STABLE
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: |
ZIPURL="https://github.com/danmarsden/moodle-mod_attendance/archive/refs/heads/{BRANCH}.zip"
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/{BRANCH}" \
--data-urlencode "altdownloadurl=${ZIPURL}")
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
Loading…
Cancel
Save