From 3b629d753afbfbffad27747ac26953da489bbb1c Mon Sep 17 00:00:00 2001 From: Oliver Tacke Date: Tue, 4 Feb 2025 15:17:41 +0100 Subject: [PATCH] Add release workflow --- .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e721a6b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release ZIP Build + +on: + release: + types: [created] + +jobs: + build-and-upload: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Install Node.js dependencies + run: npm install --production + + - name: Install Composer dependencies + run: composer install --no-dev --optimize-autoloader + + - name: Create versioned ZIP file + run: | + ZIP_NAME="moodle-local_h5pcarateker-${{ env.RELEASE_VERSION }}.zip" + echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV + zip -r "$ZIP_NAME" . \ + -x ".github/*" ".gitignore" \ + "composer.json" "composer.lock" \ + "package.json" "package-lock.json" + + - name: Upload ZIP to Release + uses: softprops/action-gh-release@v2 + with: + files: ${{ env.ZIP_NAME }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}