-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 2.65 KB
/
deploy-wp.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
name: 'deploy to WP'
on:
workflow_call:
inputs:
version:
type: string
required: true
push-tag:
type: boolean
required: true
default: false
push-trunk:
type: boolean
required: true
default: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}
# remove v from tag
- name: Set version env
run: |
TAG=${{ inputs.version }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Download plugin
uses: actions/download-artifact@v4
with:
name: ready-zip
- name: Extract Archive
run: |
mkdir zip-content
unzip inseri-core.zip -d zip-content
ls -lA zip-content
- name: Checkout from WordPress.org
run: |
svn co http://svn.wp-plugins.org/inseri-core wp/inseri-core
- name: Sync code changes to tag
if: ${{inputs.push-tag}}
run: |
rm -rf wp/inseri-core/tags/${VERSION}/*
mkdir -p wp/inseri-core/tags/${VERSION}
cp -a zip-content/* wp/inseri-core/tags/${VERSION}
ls -lA wp/inseri-core/tags/${VERSION}
- name: Sync code changes to trunk
if: ${{inputs.push-trunk}}
run: |
rm -rf wp/inseri-core/trunk/*
cp -a zip-content/* wp/inseri-core/trunk/
ls -lA wp/inseri-core/trunk/
- name: Sync asset changes
run: |
if [ -d .wordpress-org/ ]; then
rm -rf wp/inseri-core/assets/*
cp -a .wordpress-org/* wp/inseri-core/assets/
if test -n "$(find wp/inseri-core/assets/ -maxdepth 1 -name "*.png" -print -quit)"; then
svn propset svn:mime-type image/png wp/inseri-core/assets/*.png || true
fi
if test -n "$(find wp/inseri-core/assets/ -maxdepth 1 -name "*.jpg" -print -quit)"; then
svn propset svn:mime-type image/jpeg wp/inseri-core/assets/*.jpg || true
fi
if test -n "$(find wp/inseri-core/assets/ -maxdepth 1 -name "*.gif" -print -quit)"; then
svn propset svn:mime-type image/gif wp/inseri-core/assets/*.gif || true
fi
ls -lA wp/inseri-core/assets/
fi
- name: Deploy to WordPress.org
run: |
cd wp/inseri-core
svn add . --force
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %@
svn commit --no-auth-cache --non-interactive --username ${{ secrets.WP_USERNAME }} --password="${{ secrets.WP_PASSWORD }}" -m "Deploy ${{ inputs.version }} version"