-
-
Notifications
You must be signed in to change notification settings - Fork 51
105 lines (105 loc) · 4.16 KB
/
deploy-new-version-wp-org.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: New version (tag) of plugin to WordPress.org
on:
push:
tags:
- '*'
jobs:
build-plugin:
name: Build the latest version of the Visual Composer plugin
runs-on: ubuntu-20.04
steps:
- name: Setup PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Get the branch
id: get_branch
run: |
BRANCH=$(echo ${GITHUB_REF##*/} | perl -pe 's/(?(?=-)(\-.+$)|(\.\d+$))/.x/')
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
echo "GITHUB_REF: $GITHUB_REF"
echo "BRANCH: $BRANCH"
- name: Checkout code
run: |
GIT_SSL_NO_VERIFY=true git clone -b ${{ env.BRANCH }} --single-branch https://github.com/VisualComposer/builder.git --depth 1
- name: Build project
run: |
yarn --cwd ./builder install
node ./builder/_infrastructure/vcwb-builder/builder plugin -b ${{ env.VERSION }} -p ./
- name: Upload plugin zip
uses: actions/upload-artifact@v3
with:
name: visualcomposer.zip
path: visualcomposer.zip
build-dev-plugin:
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-dev.zip
path: visualcomposer.zip
deploy:
name: Add new version to WordPress.org svn repository
runs-on: ubuntu-latest
needs: [build-plugin]
steps:
- uses: actions/download-artifact@v3
with:
name: visualcomposer.zip
path: ~/download/visualcomposer
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout Wordpress.org svn repository
run: svn co https://plugins.svn.wordpress.org/visualcomposer visualcomposer-wordpress-org
- name: Create new directory
run: mkdir -p ./visualcomposer-wordpress-org/tags/${{ env.VERSION }}
- name: Copy files to trunk directory
run: rsync -rc ~/download/visualcomposer/ ./visualcomposer-wordpress-org/tags/${{ env.VERSION }} --delete
- name: Update svn repository
env:
WP_USERNAME: ${{ secrets.wordpressOrgUsername }}
WP_PASSWORD: ${{ secrets.wordpressOrgPassword }}
run: |
cd ./visualcomposer-wordpress-org
svn add --force ./tags/${{ env.VERSION }} > /dev/null
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm % > /dev/null
svn ci -m "Plugin ${{ env.VERSION }} version" --username "$WP_USERNAME" --password "$WP_PASSWORD"
deploy-trunk:
name: Update trunk on WordPress.org
needs: [build-dev-plugin, deploy]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: visualcomposer-dev.zip
path: ~/download/visualcomposer
- name: Checkout Wordpress.org svn repository
run: svn co https://plugins.svn.wordpress.org/visualcomposer visualcomposer-wordpress-org
- name: Copy files to trunk directory
run: rsync -rc ~/download/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"