Merge pull request #7 from rtCamp/feature/pull-requests #3
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: Publish Plugin to Github Releases | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| shell: bash | |
| run: | | |
| composer install --no-dev | |
| npm i | |
| - name: Build Library | |
| shell: bash | |
| run: npm run build:prod | |
| - name: Create WordPress Plugin Zip | |
| id: create-zip | |
| shell: bash | |
| run: | | |
| # Create a temporary directory for the plugin | |
| mkdir -p /tmp/oneupdate/assets/build | |
| # Copy necessary files to the plugin directory | |
| cp -r assets/build /tmp/oneupdate/assets/ | |
| cp composer.json /tmp/oneupdate/ | |
| cp -r inc/ /tmp/oneupdate/ | |
| cp oneupdate.php /tmp/oneupdate/ | |
| cp README.md /tmp/oneupdate/ | |
| cp uninstall.php /tmp/oneupdate/ | |
| cp -r vendor/ /tmp/oneupdate/ | |
| # Create the zip file | |
| cd /tmp | |
| zip -r oneupdate.zip oneupdate/ -x "*.git*" "*.DS_Store*" "*node_modules*" "*tests*" "*test*" | |
| # Move zip to workspace | |
| mv oneupdate.zip $GITHUB_WORKSPACE/ | |
| # Set output for the zip path | |
| echo "zip-path=$GITHUB_WORKSPACE/oneupdate.zip" >> $GITHUB_OUTPUT | |
| # Display zip contents for verification | |
| echo "=== Plugin zip contents ===" | |
| unzip -l $GITHUB_WORKSPACE/oneupdate.zip | |
| - name: Upload Release Artifact with gh CLI | |
| if: startsWith(github.ref, 'refs/tags/dry') == false && github.ref != 'refs/heads/develop' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release view "${{ github.ref_name }}" || \ | |
| gh release create "${{ github.ref_name }}" \ | |
| --title "${{ github.ref_name }}" \ | |
| --generate-notes \ | |
| --draft | |
| # Upload the artifact | |
| gh release upload "${{ github.ref_name }}" "${{ steps.create-zip.outputs.zip-path }}" --clobber |