Skip to content

Commit

Permalink
action for auto deploy on WordPress
Browse files Browse the repository at this point in the history
  • Loading branch information
phalkmin committed Apr 17, 2024
1 parent c10b7bf commit ec32908
Showing 1 changed file with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy to WordPress.org Repository

on:
release:
types: [released]

# A list of jobs involved in this workflow.
jobs:
deploy_to_wp_repository:
name: Deploy to WP.org
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: gattai-deploy

uses: 10up/action-wordpress-plugin-deploy@stable

with:
generate-zip: true
dry-run: false

# 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

0 comments on commit ec32908

Please sign in to comment.