Joomla Migration Tool v1.0.0 #8
Workflow file for this run
This file contains hidden or 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: CI and Release | |
| on: | |
| push: | |
| branches: [main, cypress-testing-beta] | |
| pull_request: | |
| branches: [main, cypress-testing-beta] | |
| release: | |
| types: [published] # runs only when a release is published in GitHub UI | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: joomla | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h localhost -uroot -proot" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| joomla: | |
| image: joomla:6.0-php8.3-apache | |
| env: | |
| JOOMLA_DB_HOST: mysql | |
| JOOMLA_DB_USER: root | |
| JOOMLA_DB_PASSWORD: root | |
| JOOMLA_DB_NAME: joomla | |
| ports: | |
| - 8080:80 | |
| options: >- | |
| --health-cmd="curl -f http://localhost/installation/index.php || exit 1" | |
| --health-interval=15s | |
| --health-timeout=10s | |
| --health-retries=20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.3" | |
| extensions: zip, mysqli, pdo_mysql | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.11.1" | |
| - name: Install Composer dependencies | |
| run: composer install --no-progress --prefer-dist --optimize-autoloader | |
| - name: Install NPM dependencies | |
| run: npm install | |
| - name: Install zip utility | |
| run: sudo apt-get update && sudo apt-get install -y zip | |
| - name: Wait for Joomla installer to be ready | |
| run: | | |
| for i in {1..40}; do | |
| if curl -f http://localhost:8080/installation/index.php > /dev/null 2>&1; then | |
| echo "Joomla installer is ready" | |
| break | |
| fi | |
| echo "Waiting for Joomla installer..." | |
| sleep 10 | |
| done | |
| - name: Set Joomla env | |
| run: | | |
| echo "JOOMLA_BASE_URL=http://localhost:8080" >> $GITHUB_ENV | |
| echo "JOOMLA_ADMIN_USER=admin" >> $GITHUB_ENV | |
| echo "JOOMLA_ADMIN_PASS=admin123423454664@" >> $GITHUB_ENV | |
| - name: Run tests | |
| run: composer test | |
| env: | |
| JOOMLA_BASE_URL: http://localhost:8080 | |
| JOOMLA_ADMIN_USER: admin | |
| JOOMLA_ADMIN_PASS: admin123423454664@ | |
| DBUS_SESSION_BUS_ADDRESS: /dev/null | |
| - name: Upload screenshots on failure | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-screenshots | |
| path: cypress/screenshots | |
| - name: Upload videos on failure | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-videos | |
| path: cypress/videos | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'release' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # fetch full history so branches & tags are available | |
| - name: Switch to main branch properly | |
| run: | | |
| git fetch origin main | |
| git checkout -B main origin/main | |
| - name: Extract version from release tag | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Extract wordpress plugin version | |
| run: | | |
| version_wordpress=$(grep -oP '<version>\K[^<]+' src/plugins/migration/wordpress/wordpress.xml) | |
| echo "version_wordpress=$version_wordpress" >> $GITHUB_ENV | |
| - name: Extract wp-all-export plugin version | |
| run: | | |
| version_wp_all_export=$(grep -oP '\* Version:\s*\K[^\s]+' src/cms-export-plugins/ja-wp-all-export/wp-all-export.php) | |
| echo "version_wp_all_export=$version_wp_all_export" >> $GITHUB_ENV | |
| - name: Update XML versions | |
| run: | | |
| sed -i "s|<version>.*</version>|<version>${{ steps.version.outputs.version }}</version>|" src/component/cmsmigrator.xml | |
| sed -i "s|<version>.*</version>|<version>${{ steps.version.outputs.version }}</version>|" src/modules/mod_migrationnotice/mod_migrationnotice.xml | |
| sed -i "s|<version>.*</version>|<version>${{ steps.version.outputs.version }}</version>|" pkg_cmsmigrator.xml | |
| - name: Create component zip | |
| run: | | |
| mkdir -p cypress/fixtures | |
| cd src/component | |
| zip -r ../../cypress/fixtures/com_cmsmigrator_v${{ steps.version.outputs.version }}.zip . | |
| - name: Create module zip | |
| run: | | |
| cd src/modules/mod_migrationnotice | |
| zip -r ../../../cypress/fixtures/mod_migrationnotice.zip . | |
| - name: Create package zip | |
| run: | | |
| # Copy package manifest and language files to fixtures | |
| cp pkg_cmsmigrator.xml cypress/fixtures/ | |
| cp -r language cypress/fixtures/ | |
| # Create constituents directory and move component/module zips there | |
| cd cypress/fixtures | |
| mkdir -p constituents | |
| cp com_cmsmigrator_v${{ steps.version.outputs.version }}.zip constituents/com_cmsmigrator.zip | |
| cp mod_migrationnotice.zip constituents/ | |
| # Create the package zip with the new structure | |
| zip -r pkg_cmsmigrator_v${{ steps.version.outputs.version }}.zip \ | |
| pkg_cmsmigrator.xml \ | |
| constituents/ \ | |
| language/ | |
| - name: Create wordpress plugin zip | |
| run: | | |
| cd src/plugins/migration/wordpress | |
| zip -r ../../../../cypress/fixtures/plg_wordpress_v${{ env.version_wordpress }}.zip . | |
| - name: Create wp-all-export plugin zip | |
| run: | | |
| cd src/cms-export-plugins/ja-wp-all-export | |
| zip -r ../../../cypress/fixtures/ja_wp_all_export_v${{ env.version_wp_all_export }}.zip . | |
| - name: Verify zip files exist | |
| run: ls -lh cypress/fixtures/ | |
| - name: Commit version updates | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add src/component/cmsmigrator.xml src/modules/mod_migrationnotice/mod_migrationnotice.xml pkg_cmsmigrator.xml | |
| git commit -m "Bump version to ${{ steps.version.outputs.version }}" || echo "No changes to commit" | |
| git push origin main | |
| - name: Upload assets to GitHub Release | |
| run: | | |
| gh release upload ${{ github.event.release.tag_name }} cypress/fixtures/pkg_cmsmigrator_v${{ steps.version.outputs.version }}.zip cypress/fixtures/plg_wordpress_v${{ env.version_wordpress }}.zip cypress/fixtures/ja_wp_all_export_v${{ env.version_wp_all_export }}.zip --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |