Skip to content

Commit e2e4ee5

Browse files
committed
Merge branch 'develop' for 1.3.0
2 parents 472a77d + a6cd730 commit e2e4ee5

File tree

4 files changed

+143
-49
lines changed

4 files changed

+143
-49
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributing and Maintaining
2+
3+
First, thank you for taking the time to contribute!
4+
5+
The following is a set of guidelines for contributors as well as information and instructions around our maintenance process. The two are closely tied together in terms of how we all work together and set expectations, so while you may not need to know everything in here to submit an issue or pull request, it's best to keep them in the same document.
6+
7+
## Ways to contribute
8+
9+
Contributing isn't just writing code - it's anything that improves the project. All contributions for our GitHub Actions for WordPress are managed right here on GitHub. Here are some ways you can help:
10+
11+
### Reporting bugs
12+
13+
If you're running into an issue with the action, please take a look through [existing issues](https://github.com/10up/action-wordpress-plugin-deploy/issues) and [open a new one](https://github.com/10up/action-wordpress-plugin-deploy/issues/new) if needed. If you're able, include a link to the log output from the failed run.
14+
15+
### Suggesting enhancements
16+
17+
New features and enhancements are also managed via [issues](https://github.com/10up/action-wordpress-plugin-deploy/issues).
18+
19+
### Pull requests
20+
21+
Pull requests represent a proposed solution to a specified problem. They should always reference an issue that describes the problem and contains discussion about the problem itself. Discussion on pull requests should be limited to the pull request itself, i.e. code review.
22+
23+
For more on how 10up writes and manages code, check out our [10up Engineering Best Practices](https://10up.github.io/Engineering-Best-Practices/).
24+
25+
## Workflow
26+
27+
This repository currently uses the `develop` branch to reflect active work and `master` to represent the latest tagged release. Both should typically be usable and frequently the same, but we request that pull requests be opened against `develop` and usage of the action be against `master` or a specific tag. New releases will be tagged as updates are made.
28+
29+
## Release instructions
30+
31+
1. [Create a new release](https://github.com/10up/action-wordpress-plugin-deploy/releases/new)
32+
2. Ensure it appears in the GitHub Marketplace correctly
33+
3. Celebrate shipping!

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Helen Hou-Sandi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,83 @@
11
# WordPress.org Plugin Deploy
22

3-
This Action commits the contents of your Git tag to the WordPress.org plugin repository using the same tag name. It excludes files in `.git` and `.github` subdirectories and moves anything from a `.wordpress-org` subdirectory to the top-level `assets` directory in Subversion (plugin banners, icons, and screenshots).
3+
This Action commits the contents of your Git tag to the WordPress.org plugin repository using the same tag name. It can exclude files as defined in either `.distignore` or `.gitattributes`, and moves anything from a `.wordpress-org` subdirectory to the top-level `assets` directory in Subversion (plugin banners, icons, and screenshots).
4+
5+
### ☞ For updating the readme and items in the assets directory between releases, please see our [WordPress.org Plugin Readme/Assets Update Action](https://github.com/10up/action-wordpress-plugin-asset-update)
46

57
## Configuration
68

79
### Required secrets
810
* `SVN_USERNAME`
911
* `SVN_PASSWORD`
10-
* `GITHUB_TOKEN` - you do not need to generate one but you do have to explicitly make it available to the Action
1112

12-
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/)
13+
[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.
1314

1415
### Optional environment variables
15-
* `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.
16-
* `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes
17-
* `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`)
16+
* `SLUG` - defaults to the repository name, customizable in case your WordPress repository has a different slug or is capitalized differently.
17+
* `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes.
18+
* `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`).
1819

19-
### Known issues
20-
* Currently the `tags` filter on the `push` action does not seem to work correctly, so we target the `refs/tags/*` naming of a branch instead. Ideally for readability and correctness this would use something like `tags: - *`.
20+
## Excluding files from deployment
21+
If there are files or directories to be excluded from deployment, such as tests or editor config files, they can be specified in either a `.distignore` file or a `.gitattributes` file using the `export-ignore` directive. If a `.distignore` file is present, it will be used; if not, the Action will look for a `.gitattributes` file and barring that, will write a basic temporary `.gitattributes` into place before proceeding so that no Git/GitHub-specific files are included.
2122

22-
## Example Workflow File
23+
`.distignore` is useful particularly when there are built files that are in `.gitignore`, and is a file that is used in [WP-CLI](https://wp-cli.org/). For modern plugin setups with a build step and no built files committed to the repository, this is the way forward. `.gitattributes` is useful for plugins that don't run a build step as a part of the Actions workflow and also allows for GitHub's generated ZIP files to contain the same contents as what is committed to WordPress.org. If you would like to attach a ZIP file with the proper contents that decompresses to a folder name without version number as WordPress generally expects, you can add steps to your workflow that generate the ZIP and attach it to the GitHub release (concrete examples to come).
24+
25+
### Sample baseline files
26+
27+
#### `.distignore`
28+
29+
**Notes:** `.distignore` is for files to be ignored **only**; it does not currently allow negation like `.gitignore`. This comes from its current expected syntax in WP-CLI's [`wp dist-archive` command](https://github.com/wp-cli/dist-archive-command/). It is possible that this Action will allow for includes via something like a `.distinclude` file in the future, or that WP-CLI itself makes a change that this Action will reflect for consistency. It also will need to contain more than `.gitattributes` because that method **also** respects `.gitignore`.
30+
31+
```
32+
/.wordpress-org
33+
/.git
34+
/.github
35+
/node_modules
36+
37+
.distignore
38+
.gitignore
2339
```
40+
41+
#### `.gitattributes`
42+
43+
```gitattributes
44+
# Directories
45+
/.wordpress-org export-ignore
46+
/.github export-ignore
47+
48+
# Files
49+
/.gitattributes export-ignore
50+
/.gitignore export-ignore
51+
```
52+
53+
54+
## Example Workflow File
55+
```yml
2456
name: Deploy to WordPress.org
2557
on:
2658
push:
27-
branches:
28-
- refs/tags/*
59+
tags:
60+
- "*"
2961
jobs:
3062
tag:
3163
name: New tag
3264
runs-on: ubuntu-latest
3365
steps:
3466
- uses: actions/checkout@master
67+
- name: Build
68+
run: |
69+
npm install
70+
npm run build
3571
- name: WordPress Plugin Deploy
3672
uses: 10up/action-wordpress-plugin-deploy@master
3773
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3974
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
4075
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
4176
SLUG: my-super-cool-plugin
4277
```
4378
4479
## Contributing
45-
Want to help? Check out our [contributing guidelines](../CONTRIBUTING.md) to get started.
80+
Want to help? Check out our [contributing guidelines](CONTRIBUTING.md) to get started.
4681
4782
<p align="center">
4883
<a href="http://10up.com/contact/"><img src="https://10updotcom-wpengine.s3.amazonaws.com/uploads/2016/10/10up-Github-Banner.png" width="850"></a>
@@ -52,3 +87,4 @@ Want to help? Check out our [contributing guidelines](../CONTRIBUTING.md) to get
5287
5388
Our GitHub Actions are available for use and remix under the MIT license.
5489
90+
### ☞ Check out our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress)

entrypoint.sh

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ if [[ -z "$SVN_PASSWORD" ]]; then
2020
exit 1
2121
fi
2222

23-
if [[ -z "$GITHUB_TOKEN" ]]; then
24-
echo "Set the GITHUB_TOKEN env variable"
25-
exit 1
26-
fi
27-
2823
# Allow some ENV variables to be customized
2924
if [[ -z "$SLUG" ]]; then
3025
SLUG=${GITHUB_REPOSITORY#*/}
@@ -54,39 +49,48 @@ svn update --set-depth infinity assets
5449
svn update --set-depth infinity trunk
5550

5651
echo "➤ Copying files..."
57-
cd "$GITHUB_WORKSPACE"
58-
59-
# "Export" a cleaned copy to a temp directory
60-
TMP_DIR="/github/archivetmp"
61-
mkdir "$TMP_DIR"
62-
63-
git config --global user.email "[email protected]"
64-
git config --global user.name "10upbot on GitHub"
65-
66-
# If there's no .gitattributes file, write a default one into place
67-
if [[ ! -e "$GITHUB_WORKSPACE/.gitattributes" ]]; then
68-
cat > "$GITHUB_WORKSPACE/.gitattributes" <<-EOL
69-
/$ASSETS_DIR export-ignore
70-
/.gitattributes export-ignore
71-
/.gitignore export-ignore
72-
/.github export-ignore
73-
EOL
74-
75-
# Ensure we are in the $GITHUB_WORKSPACE directory, just in case
76-
# The .gitattributes file has to be committed to be used
77-
# Just don't push it to the origin repo :)
78-
git add .gitattributes && git commit -m "Add .gitattributes file"
52+
if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then
53+
echo "ℹ︎ Using .distignore"
54+
# Copy from current branch to /trunk, excluding dotorg assets
55+
# The --delete flag will delete anything in destination that no longer exists in source
56+
rsync -rc --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete
57+
else
58+
echo "ℹ︎ Using .gitattributes"
59+
60+
cd "$GITHUB_WORKSPACE"
61+
62+
# "Export" a cleaned copy to a temp directory
63+
TMP_DIR="/github/archivetmp"
64+
mkdir "$TMP_DIR"
65+
66+
git config --global user.email "[email protected]"
67+
git config --global user.name "10upbot on GitHub"
68+
69+
# If there's no .gitattributes file, write a default one into place
70+
if [[ ! -e "$GITHUB_WORKSPACE/.gitattributes" ]]; then
71+
cat > "$GITHUB_WORKSPACE/.gitattributes" <<-EOL
72+
/$ASSETS_DIR export-ignore
73+
/.gitattributes export-ignore
74+
/.gitignore export-ignore
75+
/.github export-ignore
76+
EOL
77+
78+
# Ensure we are in the $GITHUB_WORKSPACE directory, just in case
79+
# The .gitattributes file has to be committed to be used
80+
# Just don't push it to the origin repo :)
81+
git add .gitattributes && git commit -m "Add .gitattributes file"
82+
fi
83+
84+
# This will exclude everything in the .gitattributes file with the export-ignore flag
85+
git archive HEAD | tar x --directory="$TMP_DIR"
86+
87+
cd "$SVN_DIR"
88+
89+
# Copy from clean copy to /trunk, excluding dotorg assets
90+
# The --delete flag will delete anything in destination that no longer exists in source
91+
rsync -rc "$TMP_DIR/" trunk/ --delete
7992
fi
8093

81-
# This will exclude everything in the .gitattributes file with the export-ignore flag
82-
git archive HEAD | tar x --directory="$TMP_DIR"
83-
84-
cd "$SVN_DIR"
85-
86-
# Copy from clean copy to /trunk, excluding dotorg assets
87-
# The --delete flag will delete anything in destination that no longer exists in source
88-
rsync -rc "$TMP_DIR/" trunk/ --delete
89-
9094
# Copy dotorg assets to /assets
9195
rsync -rc "$GITHUB_WORKSPACE/$ASSETS_DIR/" assets/ --delete
9296

0 commit comments

Comments
 (0)