Deploy to WordPress.org Repository #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to WordPress.org Repository | |
on: | |
# Since we want to publish new versions of our plugin, we only want this action to | |
# run when publishing a new release. | |
# | |
# The released version of the plugin will then be deployed to the repository. | |
# | |
# This allows us to run and manage plugin releases from a single location. | |
release: | |
# run only when a new release is published, but not when it's classified as a pre-release. | |
# types: [released] | |
jobs: | |
deploy_to_wp_repository: | |
name: Deploy to WP.org | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Build the dependencies. | |
- name: Build | |
run: | | |
npm install | |
npm run build | |
composer install --no-dev | |
- name: WordPress Plugin Deploy | |
# You can add unique ids to specific steps if you want to reference their output later in the workflow. | |
# | |
# Here, this unique identifier lets us use the output from the action to get the zip-path later. | |
id: deploy | |
# The use statement lets us pull in the work done by 10up to deploy the plugin to the WordPress repository. | |
uses: 10up/action-wordpress-plugin-deploy@stable | |
# Steps can also provide arguments, so this configures 10up's action to also generate a zip file. | |
with: | |
generate-zip: true | |
dry-run: true # To be removed after testing. | |
# Steps can also set environment variables which can be configured in the Github settings for the | |
# repository. Here, we are using action secrets SVN_USERNAME, SVN_PASSWORD, and PLUGIN_SLUG which | |
# authenticate with WordPress and lets the action deploy our plugin to the repository. | |
# | |
# To learn more about setting and using secrets with Github Actions, check out: https://docs.github.com/en/actions/security-guides/encrypted-secrets?tool=webui#about-encrypted-secrets | |
env: | |
SVN_USERNAME: ${{ secrets.SVN_USERNAME }} | |
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} | |
# After the deploy, we also want to create a zip and upload it to the release on Github. We don't want | |
# users to have to go to the repository to find our plugin :). | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
# Note, this is an exception to action secrets: GH_TOKEN is always available and provides access to | |
# the current repository this action runs in. | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# Get the URL for uploading assets to the current release. | |
upload_url: ${{ github.event.release.upload_url }} | |
# Provide the path to the file generated in the previous step using the output. | |
asset_path: ${{ steps.deploy.outputs.zip-path }} | |
# Provide what the file should be named when attached to the release (plugin-name.zip) | |
asset_name: ${{ github.event.repository.name }}.zip | |
# Provide the file type. | |
asset_content_type: application/zip |