Skip to content

Commit

Permalink
Merge pull request #9 from 10up/develop
Browse files Browse the repository at this point in the history
Release 1.4.0
  • Loading branch information
helen authored Oct 16, 2019
2 parents 04e44d5 + 72690bd commit 0b64e34
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 10 deletions.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/1-bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "\U0001F41B Bug report"
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

<!-- Thank you for reporting a possible bug. Please fill in as much of the template below as you can. -->

**Describe the bug**
<!-- A clear and concise description of what the bug is. -->

**Steps to Reproduce**
<!-- Steps to reproduce the behavior. -->
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->

**Additional context**
<!-- Add any other context about the problem here. -->
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/2-enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: "\U0001F680 Enhancement"
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

<!-- Thank you for suggesting an idea to make things better. Please fill in as much of the template below as you can. -->

**Is your enhancement related to a problem? Please describe.**
<!-- Please describe the problem you are trying to solve. -->

**Describe the solution you'd like**
<!-- Please describe the desired behavior. -->

**Designs**
<!-- If applicable, add mockups/screenshots/etc. to help explain your solution. -->

**Describe alternatives you've considered**
<!-- Please describe alternative solutions or features you have considered. -->

**Additional context**
<!-- Add any other context about the enhancement here. -->
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/3-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: "❓ Need help?"
about: Ask us a question, we're here to help!
title: ''
labels: question
assignees: ''

---

<!-- If you have a question that is neither a bug report nor an enhancement, then please post it here! Please fill in as much of the template below as you can. -->

**Describe your question**
<!-- A clear and concise description of what your question is. -->
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# WordPress.org Plugin Readme/Assets Update

This Action commits any `readme.txt` and WordPress.org-specific assets changes in your specified branch to the WordPress.org plugin repository if no other changes have been made since the last deployment to WordPress.org. This is useful for updating things like screenshots or `Tested up to` separately from functional changes, provided your Git branching methodology avoids changing anything else in the specified branch between functional releases. It is **highly recommended** that you use a stable branch where you only merge readme/asset commits in between larger functional merges that only occur when preparing for a release (often implemented as `master` vs. `develop`).
This Action commits any readme and WordPress.org-specific assets changes in your specified branch to the WordPress.org plugin repository if no other changes have been made since the last deployment to WordPress.org. This is useful for updating things like screenshots or `Tested up to` separately from functional changes, provided your Git branching methodology avoids changing anything else in the specified branch between functional releases. It is **highly recommended** that you use a stable branch where you only merge readme/asset commits in between larger functional merges that only occur when preparing for a release (often implemented as `master` vs. `develop`).

Because the WordPress.org plugin repository shows information from `readme.txt` in the specified `Stable tag`, this Action also attempts to parse out the stable tag from `readme.txt` and deploy to there as well as `trunk`. If your stable tag is `trunk` or a tag that does not exist in the `tags` subfolder, it will skip that part of the update and only update `trunk` and/or `assets`.
Because the WordPress.org plugin repository shows information from the readme in the specified `Stable tag`, this Action also attempts to parse out the stable tag from your readme and deploy to there as well as `trunk`. If your stable tag is `trunk` or a tag that does not exist in the `tags` subfolder, it will skip that part of the update and only update `trunk` and/or `assets`.

**Important note:** If your development process leads to a situation where `master` (or other specified branch) only contains changes to `readme.txt` or `assets` since the last sync to the plugin directory and those changes are in preparation for the next release, those changes will go live and potentially be misleading to users. Usage of this Action assumes a fairly traditional Git methodology that involves merging all changes to `master` when functional changes are ready and that this seemingly unlikely situation will therefore not happen in your repo; there are no safeguards against syncing changes based on readme/asset content, as that cannot be predicted.
**Important note:** If your development process leads to a situation where `master` (or other specified branch) only contains changes to the readme or assets directory since the last sync to the plugin directory and those changes are in preparation for the next release, those changes will go live and potentially be misleading to users. Usage of this Action assumes a fairly traditional Git methodology that involves merging all changes to `master` when functional changes are ready and that this seemingly unlikely situation will therefore not happen in your repo; there are no safeguards against syncing changes based on readme/asset content, as that cannot be predicted.

### ☞ This Action is meant to be used in tandem with our [WordPress.org Plugin Deploy Action](https://github.com/10up/action-wordpress-plugin-deploy)

Expand All @@ -17,8 +17,9 @@ Because the WordPress.org plugin repository shows information from `readme.txt`
[Secrets are set in your repository settings](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables). They cannot be viewed once stored.

### Optional environment variables
* `SLUG` - defaults to the repository name, customizable in case your WordPress repository has a different slug or is capitalized differently.
* `ASSETS_DIR` - defaults to `.wordpress-org`, customizable for other locations of WordPress.org plugin repository-specific assets that belong in the top-level `assets` directory (the one on the same level as `trunk`)
* `SLUG` - defaults to the respository name, customizable in case your WordPress repository has a different slug or is capitalized differently.
* `ASSETS_DIR` - defaults to `.wordpress-org`, customizable for other locations of WordPress.org plugin repository-specific assets that belong in the top-level `assets` directory (the one on the same level as `trunk`).
* `README_NAME` - defaults to `readme.txt`, customizable in case you use `README.md` instead, which is now quietly supported in the WordPress.org plugin repository.

## Example Workflow File
```yml
Expand Down
19 changes: 14 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ if [[ -z "$ASSETS_DIR" ]]; then
fi
echo "ℹ︎ ASSETS_DIR is $ASSETS_DIR"

if [[ -z "$README_NAME" ]]; then
README_NAME="readme.txt"
fi
echo "ℹ︎ README_NAME is $README_NAME"

SVN_URL="http://plugins.svn.wordpress.org/${SLUG}/"
SVN_DIR="/github/svn-${SLUG}"

Expand All @@ -43,6 +48,10 @@ svn update --set-depth infinity trunk
echo "➤ Copying files..."
if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then
echo "ℹ︎ Using .distignore"

# Use $TMP_DIR as the source of truth
TMP_DIR=$GITHUB_WORKSPACE

# Copy from current branch to /trunk, excluding dotorg assets
# The --delete flag will delete anything in destination that no longer exists in source
rsync -rc --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete
Expand Down Expand Up @@ -96,17 +105,17 @@ if [[ -z $(svn stat) ]]; then
# Check if there is more than just the readme.txt modified in trunk
# The leading whitespace in the pattern is important
# so it doesn't match potential readme.txt in subdirectories!
elif svn stat trunk | grep -qvi ' trunk/readme.txt$'; then
elif svn stat trunk | grep -qvi " trunk/$README_NAME$"; then
echo "🛑 Other files have been modified; changes not deployed"
exit 1
fi

# Readme also has to be updated in the .org tag
echo "➤ Preparing stable tag..."
STABLE_TAG=$(grep -m 1 "^Stable tag:" "$TMP_DIR/readme.txt" | tr -d '\r\n' | awk -F ' ' '{print $NF}')
STABLE_TAG=$(grep -m 1 "^Stable tag:" "$TMP_DIR/$README_NAME" | tr -d '\r\n' | awk -F ' ' '{print $NF}')

if [ -z "$STABLE_TAG" ]; then
echo "ℹ︎ Could not get stable tag from readme.txt";
if [[ -z "$STABLE_TAG" ]]; then
echo "ℹ︎ Could not get stable tag from $README_NAME";
HAS_STABLE=1
else
echo "ℹ︎ STABLE_TAG is $STABLE_TAG"
Expand All @@ -115,7 +124,7 @@ else
svn update --set-depth infinity "tags/$STABLE_TAG"

# Not doing the copying in SVN for the sake of easy history
rsync -c "$TMP_DIR/readme.txt" "tags/$STABLE_TAG/"
rsync -c "$TMP_DIR/$README_NAME" "tags/$STABLE_TAG/"
else
echo "ℹ︎ Tag $STABLE_TAG not found"
fi
Expand Down

0 comments on commit 0b64e34

Please sign in to comment.