CodeRabbit Generated Unit Tests: Add unit tests for PR changes #91
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: Pipeline release | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| stable_version: ${{ steps.get_version.outputs.stable_version }} | |
| zip_name: ${{ steps.zip.outputs.zip_name }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| tools: composer, phpunit | |
| extensions: simplexml | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: "Install JS dependencies" | |
| run: npm install | |
| - name: Build Javascript | |
| run: npm run build | |
| - name: Install Composer dependencies | |
| run: composer install --no-dev | |
| - name: Manipulations for WordPress Plugin Release | |
| run: sed -i 's/echo \$err;/echo esc_html(\$err);/' build/lib/autoload.php | |
| - name: Copy files to release folder | |
| run: | | |
| cp -R build/ release-plugin-directory/trunk | |
| cp sams-integration.php release-plugin-directory/trunk | |
| - name: Parse Stable Tag from readme.txt | |
| id: get_version | |
| run: | | |
| version=$(grep -Po '(?<=Stable tag: ).*' release-plugin-directory/trunk/readme.txt | xargs) | |
| echo "stable_version=$version" >> $GITHUB_ENV | |
| echo "stable_version=$version" >> $GITHUB_OUTPUT | |
| - name: Generate release zip-file | |
| id: zip | |
| run: | | |
| mkdir -p zip-release/sams-integration | |
| cp -r release-plugin-directory/trunk/* zip-release/sams-integration/ | |
| cd zip-release | |
| zip_name="sams-integration-${{ steps.get_version.outputs.stable_version }}.zip" | |
| zip -r ../$zip_name sams-integration | |
| echo "zip_name=$zip_name" >> $GITHUB_ENV | |
| echo "zip_name=$zip_name" >> $GITHUB_OUTPUT | |
| - name: Upload Pipeline Release | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: SAMS Integration ${{ steps.get_version.outputs.stable_version }} | |
| path: ${{ steps.zip.outputs.zip_name }} | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v2 | |
| # - name: Setup SVN for Deployment | |
| # env: | |
| # SVN_URL: ${{ secrets.SVN_URL }} | |
| # SVN_USER: ${{ secrets.SVN_USERNAME }} | |
| # SVN_PASS: ${{ secrets.SVN_PASSWORD }} | |
| # run: | | |
| # plugin_dir="release-plugin-directory" | |
| # echo "Committing to SVN: $SVN_URL" | |
| # svn checkout "$SVN_URL" svn-dir --username "$SVN_USER" --password "$SVN_PASS" --no-auth-cache | |
| # rsync -a --delete "$plugin_dir/" svn-dir/ | |
| # cd svn-dir | |
| # svn add --force . | |
| # svn commit -m "Release version ${{ env.stable_version }}" --username "$SVN_USER" --password "$SVN_PASS" --no-auth-cache | |
| - name: Download Release Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: SAMS Integration ${{ needs.build.outputs.stable_version }} | |
| path: release | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ needs.build.outputs.stable_version }} | |
| release_name: "SAMS Integration v${{ needs.build.outputs.stable_version }}" | |
| body: | | |
| New release of SAMS Integration Plugin. | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: release/${{ needs.build.outputs.zip_name }} | |
| asset_name: ${{ needs.build.outputs.zip_name }} | |
| asset_content_type: application/zip |