Skip to content

Commit

Permalink
Merge pull request #42 from 10up/fix/generate-zip
Browse files Browse the repository at this point in the history
Fix ZIP generation and add to readme
  • Loading branch information
helen authored May 26, 2020
2 parents d5acdd9 + cd2aeeb commit 2554539
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
47 changes: 44 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ If there are files or directories to be excluded from deployment, such as tests
```


## Example Workflow File
## Example Workflow Files

To get started, you will want to copy the contents of one of these examples into `.github/workflows/deploy.yml` and push that to your repository. You are welcome to name the file something else.

### Deploy on pushing a new tag

```yml
name: Deploy to WordPress.org
on:
Expand All @@ -64,7 +69,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build
- name: Build # Remove or modify this step as needed
run: |
npm install
npm run build
Expand All @@ -73,7 +78,43 @@ jobs:
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: my-super-cool-plugin
SLUG: my-super-cool-plugin # optional, remove if GitHub repo name matches SVN slug, including capitalization
```
### Deploy on publishing a new release and attach a ZIP file to the release
```yml
name: Deploy to WordPress.org
on:
release:
types: [published]
jobs:
tag:
name: New release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
npm install
npm run build
- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@master
with:
generate-zip: true
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deploy.outputs.zip_path }}
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
```
## Contributing
Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ svn commit -m "Update to version $VERSION from GitHub" --no-auth-cache --non-int
if ! $GENERATE_ZIP; then
echo "Generating zip file..."
cd "$SVN_DIR/trunk" || exit
zip -r "${SLUG}.zip" "$SLUG/"
zip -r "${GITHUB_WORKSPACE}/${SLUG}.zip" .
# Set GitHub "zip_path" output
echo "::set-output name=zip_path::$SVN_DIR/${SLUG}.zip"
echo "::set-output name=zip_path::$GITHUB_WORKSPACE/${SLUG}.zip"
echo "✓ Zip file generated!"
fi

Expand Down

0 comments on commit 2554539

Please sign in to comment.