Release ZIP Build #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 version from ndla-h5p-caretaker.php | |
run: | | |
VERSION=$(grep -oP "define\s*\(\s*'NDLAH5PCARETAKER_VERSION'\s*,\s*'[^']+'" ndla-h5p-caretaker.php | sed -E "s/.*'([0-9]+\.[0-9]+\.[0-9]+)'.*/\1/") | |
echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Install Node.js dependencies | |
run: npm install --production | |
- name: Install Composer dependencies | |
run: composer install --no-dev --optimize-autoloader | |
- name: Update Composer dependencies (for git-based dependencies) | |
run: composer update | |
- name: Create versioned ZIP file | |
run: | | |
ZIP_NAME="wp-ndla-h5p-caretaker-${{ env.PLUGIN_VERSION }}.zip" | |
echo "ZIP_NAME=${ZIP_NAME}" >> $GITHUB_ENV | |
zip -r "$ZIP_NAME" . \ | |
-x ".github/*" ".gitignore" ".git/*" \ | |
"docs/*" \ | |
"composer.lock" \ | |
"package-lock.json" \ | |
"phpcs.xml" | |
- name: Upload ZIP to Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ env.ZIP_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |