Skip to content

Workflow file for this run

name: Upload as release asset and transfer to moodle.org
on:
release:
types: [ published ]
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
env:
PLUGIN: mod_plugnmeet
CURL: curl -s
ENDPOINT: https://moodle.org/webservice/rest/server.php
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
FUNCTION: local_plugins_add_version
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build project
run: |
mkdir -p build/plugnmeet
rsync -ar --exclude=".*" --exclude=build ./ build/plugnmeet/
cd build
zip -X -r mod_plugnmeet.zip *
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mod_plugnmeet
path: build/mod_plugnmeet.zip
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: build/mod_plugnmeet.zip application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Call the service for moodle.org
id: add-version
run: |
if [[ ! -z "${{ github.event.inputs.tag }}" ]]; then
TAGNAME="${{ github.event.inputs.tag }}"
elif [[ $GITHUB_REF = refs/tags/* ]]; then
TAGNAME="${GITHUB_REF##*/}"
fi
if [[ -z "${TAGNAME}" ]]; then
echo "No tag name has been provided!"
exit 1
fi
ZIPURL="https://github.com/mynaparrot/plugNmeet-Moodle/releases/latest/download/mod_plugnmeet.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/${TAGNAME}" \
--data-urlencode "altdownloadurl=${ZIPURL}")
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