Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ZIP generation and add to readme #42

Merged
merged 2 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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