Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
W
WP.org Plugin Deploy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
WP.org Plugin Deploy
Commits
9b992faa
Commit
9b992faa
authored
Apr 14, 2019
by
Erick Hitter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow a tag to be updated, such as when WP compatibility is updated
parent
8a122704
Pipeline
#812
passed with stage
in 1 minute and 9 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
scripts/deploy.sh
scripts/deploy.sh
+23
-13
No files found.
scripts/deploy.sh
View file @
9b992faa
...
...
@@ -8,7 +8,7 @@ set -eo
# Provide a basic version identifier, particularly since this script
# is usually accessed via CDN.
echo
"ℹ︎ WP-ORG-PLUGIN-DEPLOY VERSION: 201904140
1
"
echo
"ℹ︎ WP-ORG-PLUGIN-DEPLOY VERSION: 201904140
2
"
if
[[
-z
"
$CI
"
]]
;
then
echo
"𝘅︎ Script is only to be run by GitLab CI"
1>&2
...
...
@@ -43,14 +43,15 @@ if [[ -z "$WP_ORG_ASSETS_DIR" ]]; then
WP_ORG_ASSETS_DIR
=
".wordpress-org"
fi
echo
"ℹ︎ PLUGIN_SLUG:
$
PLUGIN_SLUG
"
echo
"ℹ︎ PLUGIN_VERSION:
$
PLUGIN_VERSION
"
echo
"ℹ︎ WP_ORG_RELEASE_REF:
$
WP_ORG_RELEASE_REF
"
echo
"ℹ︎ WP_ORG_ASSETS_DIR:
$
WP_ORG_ASSETS_DIR
"
echo
"ℹ︎ PLUGIN_SLUG:
$
{
PLUGIN_SLUG
}
"
echo
"ℹ︎ PLUGIN_VERSION:
$
{
PLUGIN_VERSION
}
"
echo
"ℹ︎ WP_ORG_RELEASE_REF:
$
{
WP_ORG_RELEASE_REF
}
"
echo
"ℹ︎ WP_ORG_ASSETS_DIR:
$
{
WP_ORG_ASSETS_DIR
}
"
SVN_URL
=
"https://plugins.svn.wordpress.org/
${
PLUGIN_SLUG
}
/"
SVN_DIR
=
"
$CI_BUILDS_DIR
/svn-
${
PLUGIN_SLUG
}
"
TMP_DIR
=
"
$CI_BUILDS_DIR
/git-archive"
SVN_DIR
=
"
${
CI_BUILDS_DIR
}
/svn-
${
PLUGIN_SLUG
}
"
SVN_TAG_DIR
=
"
${
SVN_DIR
}
/tags/
${
PLUGIN_VERSION
}
"
TMP_DIR
=
"
${
CI_BUILDS_DIR
}
/git-archive"
# Limit checkouts for efficiency
echo
"➤ Checking out dotorg repository..."
...
...
@@ -58,7 +59,7 @@ svn checkout --depth immediates "$SVN_URL" "$SVN_DIR"
cd
"
$SVN_DIR
"
svn update
--set-depth
infinity assets
svn update
--set-depth
infinity trunk
svn update
--set-depth
infinity
"
tags/
${
PLUGIN_VERSION
}
"
svn update
--set-depth
infinity
"
$SVN_TAG_DIR
"
# Ensure we are in the $CI_PROJECT_DIR directory, just in case
echo
"➤ Copying files..."
...
...
@@ -68,8 +69,8 @@ git config --global user.email "git-contrib+ci@ethitter.com"
git config
--global
user.name
"Erick Hitter (GitLab CI)"
# If there's no .gitattributes file, write a default one into place
if
[[
!
-e
"
$
CI_PROJECT_DIR
/.gitattributes"
]]
;
then
cat
>
"
$
CI_PROJECT_DIR
/.gitattributes"
<<-
EOL
if
[[
!
-e
"
$
{
CI_PROJECT_DIR
}
/.gitattributes"
]]
;
then
cat
>
"
$
{
CI_PROJECT_DIR
}
/.gitattributes"
<<-
EOL
/
${
WP_ORG_ASSETS_DIR
}
export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
...
...
@@ -91,6 +92,13 @@ cd "$SVN_DIR"
# The --delete flag will delete anything in destination that no longer exists in source
rsync
-r
"
$TMP_DIR
/"
trunk/
--delete
# If tag already exists, update from trunk.
# Generally, this applies when bumping WP version compatibility.
if
[[
-d
"
$SVN_TAG_DIR
"
]]
;
then
echo
"➤ Updating existing tag..."
rsync
-r
trunk/
"
$SVN_TAG_DIR
"
--delete
fi
# Copy dotorg assets to /assets
rsync
-r
"
${
CI_PROJECT_DIR
}
/
${
WP_ORG_ASSETS_DIR
}
/"
assets/
--delete
...
...
@@ -104,9 +112,11 @@ svn add . --force > /dev/null
# Also suppress stdout here
svn status |
grep
'^\!'
|
sed
's/! *//'
| xargs
-I
% svn
rm
%
>
/dev/null
# Copy tag locally to make this a single commit
echo
"➤ Copying tag..."
svn
cp
"trunk"
"tags/
$PLUGIN_VERSION
"
# Copy new tag locally to make this a single commit
if
[[
!
-d
"
$SVN_TAG_DIR
"
]]
;
then
echo
"➤ Copying tag..."
svn
cp
"trunk"
"
$SVN_TAG_DIR
"
fi
svn status
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment