From fa5b2d06ae5aef2948043850bc8f05a10fda8496 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Thu, 22 Aug 2019 13:51:20 -0600 Subject: [PATCH 01/11] Add `.gitattributes` config to the readme --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 941981d..492bbcd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # WordPress.org Plugin Deploy -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). +This Action commits the contents of your Git tag to the WordPress.org plugin repository using the same tag name. It excludes Git-specific items or files and directories as optionally defined in your `.gitattributes` file, and moves anything from a `.wordpress-org` subdirectory to the top-level `assets` directory in Subversion (plugin banners, icons, and screenshots). ## Configuration @@ -16,8 +16,19 @@ Secrets can be set while editing your workflow or in the repository settings. Th * `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes * `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`) -### Known issues -* 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: - *`. +### Excluding files from deployment +If there are files or directories to be excluded from deployment, such as tests or editor config files, they can be specified in your `.gitattributes` file using the `export-ignore` directive. If you use this method, please be sure to include the following items: + +``` +# Directories +/.wordpress-org export-ignore +/.github export-ignore + +# Files +/.gitattributes export-ignore +/.gitignore export-ignore +``` + ## Example Workflow File ``` @@ -41,6 +52,9 @@ jobs: SLUG: my-super-cool-plugin ``` +### Known issues +* Currently the `tags` filter on the `push` action does not work as expected, so we target the `refs/tags/*` naming of a branch instead. Ideally for readability and correctness this would use something like `tags: - *`. + ## Contributing Want to help? Check out our [contributing guidelines](../CONTRIBUTING.md) to get started. From 3b366c2a71e55d193cdbf0544c720c9ef3b2ac0a Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Thu, 22 Aug 2019 13:54:53 -0600 Subject: [PATCH 02/11] Try code block highlighting --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 492bbcd..9cf5dd2 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Secrets can be set while editing your workflow or in the repository settings. Th ### Excluding files from deployment If there are files or directories to be excluded from deployment, such as tests or editor config files, they can be specified in your `.gitattributes` file using the `export-ignore` directive. If you use this method, please be sure to include the following items: -``` +```gitattributes # Directories /.wordpress-org export-ignore /.github export-ignore @@ -31,7 +31,7 @@ If there are files or directories to be excluded from deployment, such as tests ## Example Workflow File -``` +```yml name: Deploy to WordPress.org on: push: From f4c21b62d3c6b107d0d06538a61ceaa0c33da6c7 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Thu, 22 Aug 2019 14:25:53 -0600 Subject: [PATCH 03/11] Add CONTRIBUTING and LICENSE --- CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++++++ LICENSE | 21 +++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..07126f3 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,33 @@ +# Contributing and Maintaining + +First, thank you for taking the time to contribute! + +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. + +## Ways to contribute + +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: + +### Reporting bugs + +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. + +### Suggesting enhancements + +New features and enhancements are also managed via [issues](https://github.com/10up/action-wordpress-plugin-deploy/issues). + +### Pull requests + +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. + +For more on how 10up writes and manages code, check out our [10up Engineering Best Practices](https://10up.github.io/Engineering-Best-Practices/). + +## Workflow + +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. + +## Release instructions + +1. [Create a new release](https://github.com/10up/action-wordpress-plugin-deploy/releases/new) +2. Ensure it appears in the GitHub Marketplace correctly +3. Celebrate shipping! diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..383e41b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Helen Hou-Sandi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 77923e448c5a0e41abf52731b535b6f6f82b392c Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Thu, 22 Aug 2019 15:04:56 -0600 Subject: [PATCH 04/11] Update README link to CONTRIBUTING --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9cf5dd2..9fdfdae 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ jobs: * Currently the `tags` filter on the `push` action does not work as expected, so we target the `refs/tags/*` naming of a branch instead. Ideally for readability and correctness this would use something like `tags: - *`. ## Contributing -Want to help? Check out our [contributing guidelines](../CONTRIBUTING.md) to get started. +Want to help? Check out our [contributing guidelines](CONTRIBUTING.md) to get started.

From 08bd0f1fa02c6b5905ce43acd92944125855d4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Thu, 29 Aug 2019 19:35:14 +0200 Subject: [PATCH 05/11] Alternative configurable deploy excludes Fix https://github.com/10up/actions-wordpress/issues/1, ref https://github.com/10up/actions-wordpress/issues/7 and can satisfy https://github.com/10up/actions-wordpress/issues/3 Replace https://github.com/10up/actions-wordpress/pull/14 --- entrypoint.sh | 82 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3a3a5fb..28ba736 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -21,8 +21,9 @@ if [[ -z "$SVN_PASSWORD" ]]; then fi if [[ -z "$GITHUB_TOKEN" ]]; then - echo "Set the GITHUB_TOKEN env variable" - exit 1 + echo "ℹ︎ Deploying current working files" +else + echo "ℹ︎ Deploying files from git archive" fi # Allow some ENV variables to be customized @@ -54,39 +55,54 @@ 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 "10upbot+github@10up.com" -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" +if [[ -z "$GITHUB_TOKEN" ]]; then + # If there's no .distignore file, write a default one into place + if [[ ! -e "$GITHUB_WORKSPACE/.distignore" ]]; then + cat > "$GITHUB_WORKSPACE/.distignore" <<-EOL + /$ASSETS_DIR + /.git* + /.distignore + EOL + fi + + # Copy from current branch to /trunk, excluding dotorg assets + # The --delete flag will delete anything in destination that no longer exists in source + rsync -r --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete +else + cd "$GITHUB_WORKSPACE" + + # "Export" a cleaned copy to a temp directory + TMP_DIR="/github/archivetmp" + mkdir "$TMP_DIR" + + git config --global user.email "10upbot+github@10up.com" + 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 + + # 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 -# 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 - # Copy dotorg assets to /assets rsync -rc "$GITHUB_WORKSPACE/$ASSETS_DIR/" assets/ --delete From 666f5e0816027be6121f7dd6d47f64f882b0723f Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Thu, 29 Aug 2019 13:55:47 -0600 Subject: [PATCH 06/11] Update tag filtering in docs, yay --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9fdfdae..4e20d90 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,8 @@ If there are files or directories to be excluded from deployment, such as tests name: Deploy to WordPress.org on: push: - branches: - - refs/tags/* + tags: + - "*" jobs: tag: name: New tag @@ -52,9 +52,6 @@ jobs: SLUG: my-super-cool-plugin ``` -### Known issues -* Currently the `tags` filter on the `push` action does not work as expected, so we target the `refs/tags/*` naming of a branch instead. Ideally for readability and correctness this would use something like `tags: - *`. - ## Contributing Want to help? Check out our [contributing guidelines](CONTRIBUTING.md) to get started. From fc1e28f16af91760b815e09e204f6c722f463917 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Fri, 30 Aug 2019 15:07:41 -0600 Subject: [PATCH 07/11] Try not using `GITHUB_TOKEN` and looking for .distignore first --- entrypoint.sh | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 28ba736..b77d48d 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -20,12 +20,6 @@ if [[ -z "$SVN_PASSWORD" ]]; then exit 1 fi -if [[ -z "$GITHUB_TOKEN" ]]; then - echo "ℹ︎ Deploying current working files" -else - echo "ℹ︎ Deploying files from git archive" -fi - # Allow some ENV variables to be customized if [[ -z "$SLUG" ]]; then SLUG=${GITHUB_REPOSITORY#*/} @@ -55,20 +49,14 @@ svn update --set-depth infinity assets svn update --set-depth infinity trunk echo "➤ Copying files..." -if [[ -z "$GITHUB_TOKEN" ]]; then - # If there's no .distignore file, write a default one into place - if [[ ! -e "$GITHUB_WORKSPACE/.distignore" ]]; then - cat > "$GITHUB_WORKSPACE/.distignore" <<-EOL - /$ASSETS_DIR - /.git* - /.distignore - EOL - fi - +if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then + echo "Using .distignore" # Copy from current branch to /trunk, excluding dotorg assets # The --delete flag will delete anything in destination that no longer exists in source - rsync -r --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete + 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 From bf2c48c5ffff8ff68a897bb8b749754c7ada41ec Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Fri, 30 Aug 2019 15:09:15 -0600 Subject: [PATCH 08/11] Add special character back to info messages :) --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b77d48d..a6bf358 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -50,12 +50,12 @@ svn update --set-depth infinity trunk echo "➤ Copying files..." if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then - echo "Using .distignore" + echo "ℹ︎ Using .distignore" # 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" + echo "ℹ︎ Using .gitattributes" cd "$GITHUB_WORKSPACE" From 7884e3b8250c04200493793a4cc3712d01d097e2 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Fri, 30 Aug 2019 19:48:02 -0600 Subject: [PATCH 09/11] Update documentation and crosslink to other Actions repos --- README.md | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4e20d90..7a4b13e 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,45 @@ # WordPress.org Plugin Deploy -This Action commits the contents of your Git tag to the WordPress.org plugin repository using the same tag name. It excludes Git-specific items or files and directories as optionally defined in your `.gitattributes` file, and moves anything from a `.wordpress-org` subdirectory to the top-level `assets` directory in Subversion (plugin banners, icons, and screenshots). +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). + +### 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), part of our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress). ## Configuration ### Required secrets * `SVN_USERNAME` * `SVN_PASSWORD` -* `GITHUB_TOKEN` - you do not need to generate one but you do have to explicitly make it available to the Action -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 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. * `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes * `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`) -### Excluding files from deployment -If there are files or directories to be excluded from deployment, such as tests or editor config files, they can be specified in your `.gitattributes` file using the `export-ignore` directive. If you use this method, please be sure to include the following items: +## Excluding files from deployment +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-specific files are included. + +`.distignore` is useful particularly when there are built files that are in `.gitignore`, and is a file that is used in @wp-cli. 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 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). + +### Sample baseline files + +#### `.distignore` + +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`. + +``` +/.wordpress-org +/.git +/.github +/node_modules + +.DS_Store +.distignore +.gitignore +``` + +#### `.gitattributes` ```gitattributes # Directories @@ -46,7 +68,6 @@ jobs: - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SLUG: my-super-cool-plugin From 1f0b89c0005d9835ff62263734d0b76c0c797e08 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Fri, 30 Aug 2019 19:54:23 -0600 Subject: [PATCH 10/11] Add build step to sample workflow file Also some grammar and formatting tweaks --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7a4b13e..772e699 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ 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). -### 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), part of our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress). +### ☞ 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) + +### ☞ See our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress) ## Configuration @@ -10,23 +12,23 @@ This Action commits the contents of your Git tag to the WordPress.org plugin rep * `SVN_USERNAME` * `SVN_PASSWORD` -[Secrets are set 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. +[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. -* `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes -* `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 repository name, customizable in case your WordPress repository has a different slug or is capitalized differently. +* `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes. +* `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`). ## Excluding files from deployment -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-specific files are included. +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. -`.distignore` is useful particularly when there are built files that are in `.gitignore`, and is a file that is used in @wp-cli. 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 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). +`.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). ### Sample baseline files #### `.distignore` -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`. +**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`. ``` /.wordpress-org @@ -34,7 +36,6 @@ Notes: `.distignore` is for files to be ignored **only**; it does not currently /.github /node_modules -.DS_Store .distignore .gitignore ``` @@ -65,6 +66,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master + - name: Build + run: | + npm install + npm run build - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@master env: From a6cd730c9ab4bc22726391a403769deed1f4e9a4 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Fri, 30 Aug 2019 19:55:27 -0600 Subject: [PATCH 11/11] One more readme tweak --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 772e699..e00cc5a 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ This Action commits the contents of your Git tag to the WordPress.org plugin rep ### ☞ 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) -### ☞ See our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress) - ## Configuration ### Required secrets @@ -89,3 +87,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)