|
1 |
| -name: "Deploy to WordPress.org" |
| 1 | +name: Deploy to WordPress.org repository |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - "v*" |
| 4 | + release: |
| 5 | + types: [released] |
7 | 6 |
|
8 | 7 | jobs:
|
9 |
| - tag: |
10 |
| - name: New tag |
| 8 | + deploy_to_wordpress_org: |
| 9 | + name: Deploy release |
11 | 10 | runs-on: ubuntu-latest
|
12 | 11 | steps:
|
13 |
| - - uses: actions/checkout@main |
14 |
| - - name: WordPress Plugin Deploy |
| 12 | + # Checkout the code |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + # Optional: if we add a build step to the plugin, we can run it here. |
| 16 | + # Deploy the plugin to WordPress.org |
| 17 | + - name: WordPress plugin deploy |
| 18 | + id: deploy |
15 | 19 | uses: 10up/action-wordpress-plugin-deploy@stable
|
| 20 | + with: |
| 21 | + generate-zip: true |
16 | 22 | env:
|
17 | 23 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
|
18 | 24 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
|
19 |
| - SLUG: fewer-tags |
| 25 | + # After the deploy, we also want to create a zip and upload it to the release on Github. We don't want |
| 26 | + # users to have to go to the repository to find our plugin :). |
| 27 | + - name: Upload release asset |
| 28 | + uses: actions/upload-release-asset@v1 |
| 29 | + env: |
| 30 | + # Note, this is an exception to action secrets: GH_TOKEN is always available and provides access to |
| 31 | + # the current repository this action runs in. |
| 32 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + with: |
| 34 | + # Get the URL for uploading assets to the current release. |
| 35 | + upload_url: ${{ github.event.release.upload_url }} |
| 36 | + |
| 37 | + # Provide the path to the file generated in the previous step using the output and the id of the step. |
| 38 | + asset_path: ${{ steps.deploy.outputs.zip-path }} |
| 39 | + |
| 40 | + # Provide what the file should be named when attached to the release (plugin-name.zip) |
| 41 | + asset_name: ${{ github.event.repository.name }}.zip |
| 42 | + |
| 43 | + # Provide the file type. |
| 44 | + asset_content_type: application/zip |
0 commit comments