Update trunk on WordPress.org #197
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: Update trunk on WordPress.org | |
on: | |
schedule: | |
- cron: '10 10 * * 1' | |
jobs: | |
build-plugin: | |
if: github.repository == 'VisualComposer/builder' | |
name: Build the latest version of the Visual Composer plugin dev version | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Setup PHP version | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
- name: Checkout code | |
run: | | |
GIT_SSL_NO_VERIFY=true git clone https://github.com/VisualComposer/builder.git --depth 1 | |
- name: Build project | |
run: | | |
yarn --cwd ./builder install | |
node ./builder/_infrastructure/vcwb-builder/builder plugin -b dev -p ./ | |
- name: Upload plugin zip | |
uses: actions/upload-artifact@v3 | |
with: | |
name: visualcomposer.zip | |
path: visualcomposer.zip | |
deploy-trunk: | |
if: github.repository == 'VisualComposer/builder' | |
name: Update trunk on WordPress.org | |
needs: [build-plugin] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: visualcomposer.zip | |
path: visualcomposer.zip | |
- name: Checkout Wordpress.org svn repository | |
run: svn co https://plugins.svn.wordpress.org/visualcomposer visualcomposer-wordpress-org | |
- name: Unzip visualcomposer | |
run: unzip $GITHUB_WORKSPACE/visualcomposer.zip/visualcomposer.zip -d ./ | |
- name: Copy files to trunk directory | |
run: rsync -rc visualcomposer/ ./visualcomposer-wordpress-org/trunk/ --delete | |
- name: Update svn repository | |
env: | |
WP_USERNAME: ${{ secrets.wordpressOrgUsername }} | |
WP_PASSWORD: ${{ secrets.wordpressOrgPassword }} | |
run: | | |
cd ./visualcomposer-wordpress-org | |
svn add --force ./trunk/* > /dev/null | |
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % > /dev/null | |
svn ci -m "Trunk update with the latest version" --username "$WP_USERNAME" --password "$WP_PASSWORD" |