Skip to content

Commit 641bede

Browse files
authored
Merge pull request #89 from 10up/develop
2 parents 6b2431a + ec00982 commit 641bede

4 files changed

Lines changed: 124 additions & 54 deletions

File tree

CHANGELOG.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,38 @@ All notable changes to this project will be documented in this file, per [the Ke
44

55
## [Unreleased] - TBD
66

7+
8+
## [2.1.0] - 2022-04-12
9+
### Added
10+
- Mime type change to `image/gif` for `.gif` files (props [@doekenorg](https://github.com/doekenorg) via [#76](https://github.com/10up/action-wordpress-plugin-deploy/pull/76)).
11+
- Environment variable (`BUILD_DIR`) to deploy plugin files built into a custom directory (props [@dinhtungdu](https://github.com/dinhtungdu) via [#83](https://github.com/10up/action-wordpress-plugin-deploy/pull/83) and [#86](https://github.com/10up/action-wordpress-plugin-deploy/pull/86)).
12+
13+
### Fixed
14+
- Set correct mime type for for `.svg` files (props [@andrewheberle](https://github.com/andrewheberle) via [#78](https://github.com/10up/action-wordpress-plugin-deploy/pull/78)).
15+
- SVN error when plugin doesn't have an image (props [@Lewiscowles1986](https://github.com/Lewiscowles1986) via [#82](https://github.com/10up/action-wordpress-plugin-deploy/pull/82)).
16+
717
## [2.0.0] - 2021-08-16
818
This is now a composite Action, meaning that it runs directly on the GitHub Actions runner rather than spinning up its own container and is significantly faster.
919

1020
### Added
11-
- Add `zip-path` output, as the `SLUG` may not match the repository name. Props [@ocean90](https://github.com/ocean90) via [#74](https://github.com/10up/action-wordpress-plugin-deploy/pull/74).
21+
- Add `zip-path` output, as the `SLUG` may not match the repository name (props [@ocean90](https://github.com/ocean90) via [#74](https://github.com/10up/action-wordpress-plugin-deploy/pull/74)).
1222

1323
### Fixed
14-
- Avoid a Debian image issue where the container could not be built. Props [@helen](https://github.com/helen) via [#74](https://github.com/10up/action-wordpress-plugin-deploy/pull/74).
24+
- Avoid a Debian image issue where the container could not be built (props [@helen](https://github.com/helen) via [#74](https://github.com/10up/action-wordpress-plugin-deploy/pull/74)).
1525

1626
## [1.5.0] - 2020-05-27
1727
### Added
18-
- Add optional ZIP file generation from SVN trunk to match content on WordPress.org. Props [@shivapoudel](https://github.com/shivapoudel) via [#37](https://github.com/10up/action-wordpress-plugin-deploy/pull/37).
19-
- Add example workflow file to attach the ZIP file to a GitHub release. Props [@helen](https://github.com/helen) via [#42](https://github.com/10up/action-wordpress-plugin-deploy/pull/42).
20-
- Set mime types on images in the SVN `assets` directory to prevent forced downloads on WordPress.org. Props [@nextgenthemes](https://github.com/nextgenthemes) via [#40](https://github.com/10up/action-wordpress-plugin-deploy/pull/40).
28+
- Add optional ZIP file generation from SVN trunk to match content on WordPress.org (props [@shivapoudel](https://github.com/shivapoudel) via [#37](https://github.com/10up/action-wordpress-plugin-deploy/pull/37)).
29+
- Add example workflow file to attach the ZIP file to a GitHub release (props [@helen](https://github.com/helen) via [#42](https://github.com/10up/action-wordpress-plugin-deploy/pull/42)).
30+
- Set mime types on images in the SVN `assets` directory to prevent forced downloads on WordPress.org (props [@nextgenthemes](https://github.com/nextgenthemes) via [#40](https://github.com/10up/action-wordpress-plugin-deploy/pull/40)).
2131

2232
## [1.4.1] - 2020-03-12
2333
### Fixed
24-
- Ensure previously committed files that are later added to `.distignore` get deleted. Props [@pascalknecht](https://github.com/pascalknecht) via [#26](https://github.com/10up/action-wordpress-plugin-deploy/pull/26).
25-
- Escape filenames to avoid errors with filenames containing an `@` symbol. Props [@Gaya](https://github.com/Gaya) via [#22](https://github.com/10up/action-wordpress-plugin-deploy/pull/22).
26-
- Use parameter expansion instead of `sed` to remove `v` from version numbers. Props [@szepeviktor](https://github.com/szepeviktor) via [#24](https://github.com/10up/action-wordpress-plugin-deploy/pull/24).
27-
- Use `https` for WordPress.org URLs. Props [@dinhtungdu](https://github.com/dinhtungdu) via [#28](https://github.com/10up/action-wordpress-plugin-deploy/pull/28).
28-
- Correct encrypted secrets documentation link. Props [@felipeelia](https://github.com/felipeelia) via [#20](https://github.com/10up/action-wordpress-plugin-deploy/pull/20).
34+
- Ensure previously committed files that are later added to `.distignore` get deleted (props [@pascalknecht](https://github.com/pascalknecht) via [#26](https://github.com/10up/action-wordpress-plugin-deploy/pull/26)).
35+
- Escape filenames to avoid errors with filenames containing an `@` symbol (props [@Gaya](https://github.com/Gaya) via [#22](https://github.com/10up/action-wordpress-plugin-deploy/pull/22)).
36+
- Use parameter expansion instead of `sed` to remove `v` from version numbers (props [@szepeviktor](https://github.com/szepeviktor) via [#24](https://github.com/10up/action-wordpress-plugin-deploy/pull/24)).
37+
- Use `https` for WordPress.org URLs (props [@dinhtungdu](https://github.com/dinhtungdu) via [#28](https://github.com/10up/action-wordpress-plugin-deploy/pull/28)).
38+
- Correct encrypted secrets documentation link (props [@felipeelia](https://github.com/felipeelia) via [#20](https://github.com/10up/action-wordpress-plugin-deploy/pull/20)).
2939

3040
## [1.4.0] - 2019-10-21
3141
### Added
@@ -36,7 +46,7 @@ This is now a composite Action, meaning that it runs directly on the GitHub Acti
3646

3747
## [1.3.0] - 2019-08-30
3848
### Added
39-
- Added the ability to use `.distignore` to exclude files from deployment instead of `.gitattributes`, which works better when a build step is included. Props [@LeoColomb](https://github.com/LeoColomb) via [#3](https://github.com/10up/action-wordpress-plugin-deploy/pull/3), with additional thanks to [@markjaquith](https://github.com/markjaquith) for consultation.
49+
- Added the ability to use `.distignore` to exclude files from deployment instead of `.gitattributes`, which works better when a build step is included (props [@LeoColomb](https://github.com/LeoColomb) via [#3](https://github.com/10up/action-wordpress-plugin-deploy/pull/3), with additional thanks to [@markjaquith](https://github.com/markjaquith) for consultation).
4050

4151
### Changed
4252
- Removed unnecessary `GITHUB_TOKEN` check/requirement.
@@ -46,6 +56,9 @@ This is now a composite Action, meaning that it runs directly on the GitHub Acti
4656
- Use more robust method of copying files (`-c` flag for `rsync`).
4757

4858
[Unreleased]: https://github.com/10up/action-wordpress-plugin-deploy/compare/stable...develop
59+
[2.1.0]: https://github.com/10up/action-wordpress-plugin-deploy/compare/2.0.0...2.1.0
60+
[2.0.0]: https://github.com/10up/action-wordpress-plugin-deploy/compare/1.5.0...2.0.0
61+
[1.5.0]: https://github.com/10up/action-wordpress-plugin-deploy/compare/1.4.1...1.5.0
4962
[1.4.1]: https://github.com/10up/action-wordpress-plugin-deploy/compare/1.4.0...1.4.1
5063
[1.4.0]: https://github.com/10up/action-wordpress-plugin-deploy/compare/1.3.0...1.4.0
5164
[1.3.0]: https://github.com/10up/action-wordpress-plugin-deploy/compare/1.2.1...1.3.0

CREDITS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The following acknowledges the Maintainers for this repository, those who have Contributed to this repository (via bug reports, code, design, ideas, project management, translation, testing, etc.), and any Libraries utilized.
2+
3+
## Maintainers
4+
5+
The following individuals are responsible for curating the list of issues, responding to pull requests, and ensuring regular releases happen.
6+
7+
[Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul).
8+
9+
## Contributors
10+
11+
Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.
12+
13+
[Mark Jaquith (@markjaquith)](https://github.com/markjaquith), [Ciprian Popescu (@wolffe)](https://github.com/wolffe), [Léo Colombaro (@LeoColomb)](https://github.com/LeoColomb), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Vincenzo Russo (@vincenzo)](https://github.com/vincenzo), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Nikhil (@Nikschavan)](https://github.com/Nikschavan), [Niels Lange (@nielslange)](https://github.com/nielslange), [Stiofan O'Connor (@Stiofan)](https://github.com/Stiofan), [Sébastien SERRE (@sebastienserre)](https://github.com/sebastienserre), [Ram Ratan Maurya (@mauryaratan)](https://github.com/mauryaratan), [Johannes Siipola (@joppuyo)](https://github.com/joppuyo), [Felipe Elia (@felipeelia)](https://github.com/felipeelia), [Mobeen Abdullah (@mobeenabdullah)](https://github.com/mobeenabdullah), [Gaya Kessler (@Gaya)](https://github.com/Gaya), [Viktor Szépe (@szepeviktor)](https://github.com/szepeviktor), [Grégory Viguier (@Screenfeed)](https://github.com/Screenfeed), [Pascal Knecht (@pascalknecht)](https://github.com/pascalknecht), [Stanislav Khromov (@khromov)](https://github.com/khromov), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Jakub Mikita (@Kubitomakita)](https://github.com/Kubitomakita), [Lucas Bustamante (@Luc45)](https://github.com/Luc45), [Thien Nguyen (@tatthien-zz)](https://github.com/tatthien-zz), [Shiva Poudel (@shivapoudel)](https://github.com/shivapoudel), [null (@nextgenthemes)](https://github.com/nextgenthemes), [Tom Usborne (@tomusborne)](https://github.com/tomusborne), [dean shmuel (@deanshmuel)](https://github.com/deanshmuel), [Peter Adams (@padams)](https://github.com/padams), [Kevin Batdorf (@KevinBatdorf)](https://github.com/KevinBatdorf), [Q (@qstudio)](https://github.com/qstudio), [null (@om4csaba)](https://github.com/om4csaba), [Roman Sapezhko (@shmidtelson)](https://github.com/shmidtelson), [null (@luizkim)](https://github.com/luizkim), [René Hermenau (@rene-hermenau)](https://github.com/rene-hermenau), [Lewis Cowles (@Lewiscowles1986)](https://github.com/Lewiscowles1986), [Dominik Schilling (@ocean90)](https://github.com/ocean90), [Santiago Becerra (@sanbec)](https://github.com/sanbec), [Marijn Bent (@marijnbent)](https://github.com/marijnbent), [Jasan (@jasan-s)](https://github.com/jasan-s), [Dale Nguyen (@dalenguyen)](https://github.com/dalenguyen), [Darren Cooney (@dcooney)](https://github.com/dcooney), [Karolína Vyskočilová (@vyskoczilova)](https://github.com/vyskoczilova), [Rafał Sztwiorok (@sztwiorok)](https://github.com/sztwiorok), [Alec Rust (@AlecRust)](https://github.com/AlecRust), [Jonny Harris (@spacedmonkey)](https://github.com/spacedmonkey), [Doeke Norg (@doekenorg)](https://github.com/doekenorg), [Andrew Heberle (@andrewheberle)](https://github.com/andrewheberle), [Takashi Hosoya (@tkc49)](https://github.com/tkc49), [Fabian Marz (@fabianmarz)](https://github.com/fabianmarz), [David Herron (@robogeek)](https://github.com/robogeek), [Sergey Kotlov (@sery0ga)](https://github.com/sery0ga), [Samuel Wood (@Otto42)](https://github.com/Otto42), [IgorChernenko (@igorchernenko92)](https://github.com/igorchernenko92).
14+
15+
## Libraries
16+
17+
The following software libraries are utilized in this repository.
18+
19+
n/a.

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# WordPress.org Plugin Deploy
22

3+
> Deploy your plugin to the WordPress.org repository using GitHub Actions.
4+
5+
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/action-wordpress-plugin-deploy.svg)](https://github.com/10up/action-wordpress-plugin-deploy/releases/latest) [![MIT License](https://img.shields.io/github/license/10up/action-wordpress-plugin-deploy.svg)](https://github.com/10up/action-wordpress-plugin-deploy/blob/develop/LICENSE)
6+
37
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).
48

59
### ☞ 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)
610

11+
### ☞ Check out our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress)
12+
713
## Configuration
814

915
### Required secrets
@@ -16,6 +22,7 @@ This Action commits the contents of your Git tag to the WordPress.org plugin rep
1622
* `SLUG` - defaults to the repository name, customizable in case your WordPress repository has a different slug or is capitalized differently.
1723
* `VERSION` - defaults to the tag name; do not recommend setting this except for testing purposes.
1824
* `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`).
25+
* `BUILD_DIR` - defaults to `false`. Set this flag to the directory where you build your plugins files into, then the action will copy and deploy files from that directory. Both absolute and relative paths are supported. The relative path if provided will be concatenated with the repository root directory. All files and folders in the build directory will be deployed, `.disignore` or `.gitattributes` will be ignored.
1926

2027
### Inputs
2128
* `generate-zip` - Generate a ZIP file from the SVN `trunk` directory. Outputs a `zip-path` variable for use in further workflow steps. Defaults to false.
@@ -130,7 +137,9 @@ Want to help? Check out our [contributing guidelines](CONTRIBUTING.md) to get st
130137
131138
Our GitHub Actions are available for use and remix under the MIT license.
132139
133-
### ☞ Check out our [collection of WordPress-focused GitHub Actions](https://github.com/10up/actions-wordpress)
140+
## Support Level
141+
142+
**Active:** 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.
134143
135144
## Like what you see?
136145

deploy.sh

Lines changed: 71 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ if [[ -z "$ASSETS_DIR" ]]; then
3838
fi
3939
echo "ℹ︎ ASSETS_DIR is $ASSETS_DIR"
4040

41+
if [[ -z "$BUILD_DIR" ]] || [[ $BUILD_DIR == "./" ]]; then
42+
BUILD_DIR=false
43+
elif [[ $BUILD_DIR == ./* ]]; then
44+
BUILD_DIR=${BUILD_DIR:2}
45+
fi
46+
47+
if [[ "$BUILD_DIR" != false ]]; then
48+
if [[ $BUILD_DIR != /* ]]; then
49+
BUILD_DIR="${GITHUB_WORKSPACE%/}/${BUILD_DIR%/}"
50+
fi
51+
echo "ℹ︎ BUILD_DIR is $BUILD_DIR"
52+
fi
53+
4154
SVN_URL="https://plugins.svn.wordpress.org/${SLUG}/"
4255
SVN_DIR="${HOME}/svn-${SLUG}"
4356

@@ -49,47 +62,53 @@ cd "$SVN_DIR"
4962
svn update --set-depth infinity assets
5063
svn update --set-depth infinity trunk
5164

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

88-
cd "$SVN_DIR"
89-
90-
# Copy from clean copy to /trunk, excluding dotorg assets
91-
# The --delete flag will delete anything in destination that no longer exists in source
92-
rsync -rc "$TMP_DIR/" trunk/ --delete --delete-excluded
66+
if [[ "$BUILD_DIR" = false ]]; then
67+
echo "➤ Copying files..."
68+
if [[ -e "$GITHUB_WORKSPACE/.distignore" ]]; then
69+
echo "ℹ︎ Using .distignore"
70+
# Copy from current branch to /trunk, excluding dotorg assets
71+
# The --delete flag will delete anything in destination that no longer exists in source
72+
rsync -rc --exclude-from="$GITHUB_WORKSPACE/.distignore" "$GITHUB_WORKSPACE/" trunk/ --delete --delete-excluded
73+
else
74+
echo "ℹ︎ Using .gitattributes"
75+
76+
cd "$GITHUB_WORKSPACE"
77+
78+
# "Export" a cleaned copy to a temp directory
79+
TMP_DIR="${HOME}/archivetmp"
80+
mkdir "$TMP_DIR"
81+
82+
git config --global user.email "10upbot+github@10up.com"
83+
git config --global user.name "10upbot on GitHub"
84+
85+
# If there's no .gitattributes file, write a default one into place
86+
if [[ ! -e "$GITHUB_WORKSPACE/.gitattributes" ]]; then
87+
cat > "$GITHUB_WORKSPACE/.gitattributes" <<-EOL
88+
/$ASSETS_DIR export-ignore
89+
/.gitattributes export-ignore
90+
/.gitignore export-ignore
91+
/.github export-ignore
92+
EOL
93+
94+
# Ensure we are in the $GITHUB_WORKSPACE directory, just in case
95+
# The .gitattributes file has to be committed to be used
96+
# Just don't push it to the origin repo :)
97+
git add .gitattributes && git commit -m "Add .gitattributes file"
98+
fi
99+
100+
# This will exclude everything in the .gitattributes file with the export-ignore flag
101+
git archive HEAD | tar x --directory="$TMP_DIR"
102+
103+
cd "$SVN_DIR"
104+
105+
# Copy from clean copy to /trunk, excluding dotorg assets
106+
# The --delete flag will delete anything in destination that no longer exists in source
107+
rsync -rc "$TMP_DIR/" trunk/ --delete --delete-excluded
108+
fi
109+
else
110+
echo "ℹ︎ Copying files from build directory..."
111+
rsync -rc "$BUILD_DIR/" trunk/ --delete --delete-excluded
93112
fi
94113

95114
# Copy dotorg assets to /assets
@@ -115,8 +134,18 @@ svn cp "trunk" "tags/$VERSION"
115134

116135
# Fix screenshots getting force downloaded when clicking them
117136
# https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/
118-
svn propset svn:mime-type image/png assets/*.png || true
119-
svn propset svn:mime-type image/jpeg assets/*.jpg || true
137+
if test -d "$SVN_DIR/assets" && test -n "$(find "$SVN_DIR/assets" -maxdepth 1 -name "*.png" -print -quit)"; then
138+
svn propset svn:mime-type "image/png" "$SVN_DIR/assets/*.png" || true
139+
fi
140+
if test -d "$SVN_DIR/assets" && test -n "$(find "$SVN_DIR/assets" -maxdepth 1 -name "*.jpg" -print -quit)"; then
141+
svn propset svn:mime-type "image/jpeg" "$SVN_DIR/assets/*.jpg" || true
142+
fi
143+
if test -d "$SVN_DIR/assets" && test -n "$(find "$SVN_DIR/assets" -maxdepth 1 -name "*.gif" -print -quit)"; then
144+
svn propset svn:mime-type "image/gif" "$SVN_DIR/assets/*.gif" || true
145+
fi
146+
if test -d "$SVN_DIR/assets" && test -n "$(find "$SVN_DIR/assets" -maxdepth 1 -name "*.svg" -print -quit)"; then
147+
svn propset svn:mime-type "image/svg+xml" "$SVN_DIR/assets/*.svg" || true
148+
fi
120149

121150
svn status
122151

0 commit comments

Comments
 (0)