You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.9 KiB
51 lines
1.9 KiB
#
|
|
# 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
|
|
|