Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
View All Posts Pages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WP Plugins
View All Posts Pages
Commits
dac44889
Commit
dac44889
authored
6 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Begin porting Travis-specific WP.org release process
See
https://deliciousbrains.com/deploying-wordpress-plugins-travis/
parent
ea08c00c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!6
Introduce automated deploy to WP.org
Pipeline
#457
failed
6 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+8
-0
8 additions, 0 deletions
.gitlab-ci.yml
bin/deploy.sh
+103
-0
103 additions, 0 deletions
bin/deploy.sh
with
111 additions
and
0 deletions
.gitlab-ci.yml
+
8
−
0
View file @
dac44889
...
...
@@ -26,6 +26,7 @@ before_script:
-
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs,$HOME/.composer/vendor/phpcompatibility/php-compatibility,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-paragonie,$HOME/.composer/vendor/phpcompatibility/phpcompatibility-wp
PHPunit:PHP7.2:MySQL
:
stage
:
test
image
:
containers.ethitter.com:443/docker/images/php:7.2
services
:
-
mysql:5.6
...
...
@@ -33,3 +34,10 @@ PHPunit:PHP7.2:MySQL:
-
find . -type "f" -iname "*.php" | xargs -L "1" php -l
-
phpcs -n
-
phpunit
PluginSVN
:
stage
:
deploy
script
:
./bin/deploy.sh
when
:
on_success
# only:
# - master
This diff is collapsed.
Click to expand it.
bin/deploy.sh
0 → 100755
+
103
−
0
View file @
dac44889
#!/usr/bin/env bash
echo
"Unfinished"
1>&2
exit
1
if
[[
-z
"
$CI
"
]]
;
then
echo
"Script is only to be run by GitLab CI"
1>&2
exit
1
fi
if
[[
-z
"
$WP_ORG_PASSWORD
"
]]
;
then
echo
"WordPress.org password not set"
1>&2
exit
1
fi
if
[[
-z
"
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
"
||
"
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
"
!=
"master"
]]
;
then
echo
"Build branch is required and must be 'master'"
1>&2
exit
0
fi
WP_ORG_USERNAME
=
"ethitter"
PLUGIN
=
"view-all-posts-pages"
PROJECT_ROOT
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
/.."
&&
pwd
)
"
PLUGIN_BUILDS_PATH
=
"
$PROJECT_ROOT
/builds"
#PLUGIN_BUILD_CONFIG_PATH="$PROJECT_ROOT/build-cfg"
#VERSION=$(/usr/bin/php -f "$PLUGIN_BUILD_CONFIG_PATH/utils/get_plugin_version.php" "$PROJECT_ROOT" "$PLUGIN")
VERSION
=
grep
-o
"(^|
\s
|
\*
)+Version:
\s
+([0-9]|
\.
)*(?=
\s
|
$)
"
"
$PROJECT_ROOT
/
$PLUGIN
/
$PLUGIN
.php"
#ZIP_FILE="$PLUGIN_BUILDS_PATH/$PLUGIN-$VERSION.zip"
# Ensure the zip file for the current version has been built
#if [ ! -f "$ZIP_FILE" ]; then
# echo "Built zip file $ZIP_FILE does not exist" 1>&2
# exit 1
#fi
# Check if the tag exists for the version we are building
TAG
=
$(
svn
ls
"https://plugins.svn.wordpress.org/
$PLUGIN
/tags/
$VERSION
"
)
error
=
$?
if
[
$error
==
0
]
;
then
# Tag exists, don't deploy
echo
"Tag already exists for version
$VERSION
, aborting deployment"
exit
1
fi
cd
"
$PLUGIN_BUILDS_PATH
"
# Remove any unzipped dir so we start from scratch
rm
-fR
"
$PLUGIN
"
# Unzip the built plugin
#unzip -q -o "$ZIP_FILE"
# Clean up any previous svn dir
rm
-fR
svn
# Checkout the SVN repo
svn co
-q
"http://svn.wp-plugins.org/
$PLUGIN
"
svn
# Move out the trunk directory to a temp location
mv
svn/trunk ./svn-trunk
# Create trunk directory
mkdir
svn/trunk
# Copy our new version of the plugin into trunk
rsync
-r
-p
$PLUGIN
/
*
svn/trunk
# Copy all the .svn folders from the checked out copy of trunk to the new trunk.
# This is necessary as the Travis container runs Subversion 1.6 which has .svn dirs in every sub dir
cd
svn/trunk/
TARGET
=
$(
pwd
)
cd
../../svn-trunk/
# Find all .svn dirs in sub dirs
SVN_DIRS
=
`
find
.
-type
d
-iname
.svn
`
for
SVN_DIR
in
$SVN_DIRS
;
do
SOURCE_DIR
=
${
SVN_DIR
/.
}
TARGET_DIR
=
$TARGET
${
SOURCE_DIR
/.svn
}
TARGET_SVN_DIR
=
$TARGET
${
SVN_DIR
/.
}
if
[
-d
"
$TARGET_DIR
"
]
;
then
# Copy the .svn directory to trunk dir
cp
-r
$SVN_DIR
$TARGET_SVN_DIR
fi
done
# Back to builds dir
cd
../
# Remove checked out dir
rm
-fR
svn-trunk
# Add new version tag
#mkdir svn/tags/$VERSION
#rsync -r -p $PLUGIN/* svn/tags/$VERSION
# Add new files to SVN
svn
stat
svn |
grep
'^?'
|
awk
'{print $2}'
| xargs
-I
x svn add x@
# Remove deleted files from SVN
svn
stat
svn |
grep
'^!'
|
awk
'{print $2}'
| xargs
-I
x svn
rm
--force
x@
svn
stat
svn
# Commit to SVN
#svn ci --no-auth-cache --username $WP_ORG_USERNAME --password $WP_ORG_PASSWORD svn -m "Deploy version $VERSION"
# Remove SVN temp dir
rm
-fR
svn
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment