Skip to content

Commit

Permalink
Merge branch 'develop' into fix/readme-name
Browse files Browse the repository at this point in the history
  • Loading branch information
helen authored Oct 16, 2019
2 parents 68a55e3 + c3ede1e commit 5c4e8f8
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 32 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. -->
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ Because the WordPress.org plugin repository shows information from the readme in

**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)

## Configuration

### Required secrets
* `SVN_USERNAME`
* `SVN_PASSWORD`

Secrets can be set while editing your workflow or in the repository settings. They cannot be viewed once stored. [GitHub secrets documentation](https://developer.github.com/actions/creating-workflows/storing-secrets/)
[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 respository name, customizable in case your WordPress repository has a different slug. This should be a very rare case as WordPress assumes that the directory and initial plugin file have the same slug.
* `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.

Expand Down Expand Up @@ -53,3 +55,4 @@ Want to help? Check out our [contributing guidelines](CONTRIBUTING.md) to get st

Our GitHub Actions are available for use and remix under the MIT license.

### ☞ Check out our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress)
73 changes: 43 additions & 30 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,51 @@ svn update --set-depth infinity assets
svn update --set-depth infinity trunk

echo "➤ Copying files..."
cd "$GITHUB_WORKSPACE"

# "Export" a cleaned copy to a temp directory
TMP_DIR="/github/archivetmp"
mkdir "$TMP_DIR"

git config --global user.email "[email protected]"
git config --global user.name "10upbot on GitHub"

# If there's no .gitattributes file, write a default one into place
if [[ ! -e "$GITHUB_WORKSPACE/.gitattributes" ]]; then
cat > "$GITHUB_WORKSPACE/.gitattributes" <<-EOL
/$ASSETS_DIR export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
EOL

# Ensure we are in the $GITHUB_WORKSPACE directory, just in case
# The .gitattributes file has to be committed to be used
# Just don't push it to the origin repo :)
git add .gitattributes && git commit -m "Add .gitattributes file"
fi
if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then
echo "ℹ︎ Using .distignore"

# This will exclude everything in the .gitattributes file with the export-ignore flag
git archive HEAD | tar x --directory="$TMP_DIR"
# Use $TMP_DIR as the source of truth
TMP_DIR=$GITHUB_WORKSPACE

cd "$SVN_DIR"
# 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
else
echo "ℹ︎ Using .gitattributes"

cd "$GITHUB_WORKSPACE"

# "Export" a cleaned copy to a temp directory
TMP_DIR="/github/archivetmp"
mkdir "$TMP_DIR"

git config --global user.email "[email protected]"
git config --global user.name "10upbot on GitHub"

# If there's no .gitattributes file, write a default one into place
if [[ ! -e "$GITHUB_WORKSPACE/.gitattributes" ]]; then
cat > "$GITHUB_WORKSPACE/.gitattributes" <<-EOL
/$ASSETS_DIR export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
EOL

# Ensure we are in the $GITHUB_WORKSPACE directory, just in case
# The .gitattributes file has to be committed to be used
# Just don't push it to the origin repo :)
git add .gitattributes && git commit -m "Add .gitattributes file"
fi

# Copy from clean copy to /trunk, excluding dotorg assets
# The --delete flag will delete anything in destination that no longer exists in source
rsync -rc "$TMP_DIR/" trunk/ --delete
# This will exclude everything in the .gitattributes file with the export-ignore flag
git archive HEAD | tar x --directory="$TMP_DIR"

cd "$SVN_DIR"

# Copy from clean copy to /trunk, excluding dotorg assets
# The --delete flag will delete anything in destination that no longer exists in source
rsync -rc "$TMP_DIR/" trunk/ --delete
fi

# Copy dotorg assets to /assets
rsync -rc "$GITHUB_WORKSPACE/$ASSETS_DIR/" assets/ --delete
Expand All @@ -88,7 +101,7 @@ svn status

if [[ -z $(svn stat) ]]; then
echo "🛑 Nothing to deploy!"
exit 78
exit 0
# 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!
Expand Down

0 comments on commit 5c4e8f8

Please sign in to comment.