Skip to content

Commit 283d644

Browse files
author
Poly Plugins
committed
Added: Actions
1 parent b071b79 commit 283d644

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# The name of the Github Action that displays in github.com/<username>/<repo>/actions
2+
name: Deploy to WordPress.org Repository
3+
4+
# Here we can define the events "on" which the action should be triggered.
5+
on:
6+
7+
# Since we want to publish new versions of our plugin, we only want this action to
8+
# run when publishing a new release.
9+
#
10+
# The released version of the plugin will then be deployed to the repository.
11+
#
12+
# This allows us to run and manage plugin releases from a single location.
13+
release:
14+
15+
# run only when a new release is published, but not when it's classified as a pre-release.
16+
types: [released]
17+
18+
# A list of jobs involved in this workflow.
19+
jobs:
20+
21+
# A unique job identifier.
22+
#
23+
# Github Actions can have multiple jobs and each can be referenced by its name.
24+
# However, we only need to run a few steps here and they can be handled in a single job.
25+
deploy_to_wp_repository:
26+
27+
# The proper name for the job being run.
28+
name: Deploy to WP.org
29+
30+
# The environment this job should run on. In the context of WordPress, ubuntu-latest is
31+
# pretty typical. Since we are only interacting with git and subversion, Ubuntu is perfect
32+
# for this.
33+
#
34+
# Github does offer other platforms if you need them: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
35+
runs-on: ubuntu-latest
36+
37+
# Every job has a specific set of steps that it goes through to do its "work".
38+
#
39+
# Each step has a two key elements:
40+
# • Name
41+
# • a "run" command (an arbitrary CLI command to execute) OR a "uses" command that pulls in and executes a 3rd party action.
42+
steps:
43+
44+
# Most workflows begin by checking out the repository into the workflow filesystem.
45+
#
46+
# This is just like cloning a repository except it only checks out the specific commit
47+
# the job is executed for. In our case here, the commit that the release is attached to.
48+
- name: Checkout code
49+
uses: actions/checkout@v2
50+
51+
# Optional: If your plugin is using composer dependencies, we want to include them
52+
# WITHOUT the dev dependencies.
53+
# - name: Build
54+
# run: |
55+
# npm install
56+
# npm run build
57+
58+
- name: WordPress Plugin Deploy
59+
60+
# You can add unique ids to specific steps if you want to reference their output later in the workflow.
61+
#
62+
# Here, this unique identifier lets us use the output from the action to get the zip-path later.
63+
id: deploy
64+
65+
# The use statement lets us pull in the work done by 10up to deploy the plugin to the WordPress repository.
66+
uses: 10up/action-wordpress-plugin-deploy@stable
67+
68+
# Steps can also provide arguments, so this configures 10up's action to also generate a zip file.
69+
with:
70+
generate-zip: true
71+
72+
# Steps can also set environment variables which can be configured in the Github settings for the
73+
# repository. Here, we are using action secrets SVN_USERNAME, SVN_PASSWORD, and PLUGIN_SLUG which
74+
# authenticate with WordPress and lets the action deploy our plugin to the repository.
75+
#
76+
# 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
77+
env:
78+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
79+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
80+
81+
# After the deploy, we also want to create a zip and upload it to the release on Github. We don't want
82+
# users to have to go to the repository to find our plugin :).
83+
- name: Upload release asset
84+
uses: softprops/action-gh-release@v2
85+
env:
86+
# Note, this is an exception to action secrets: GH_TOKEN is always available and provides access to
87+
# the current repository this action runs in.
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
90+
with:
91+
# Provide what the file should be named when attached to the release (plugin-name.zip)
92+
files: ${{ github.workspace }}/${{ github.event.repository.name }}.zip
93+

.github/workflows/update.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Plugin asset/readme update
2+
on:
3+
push:
4+
branches:
5+
- trunk
6+
jobs:
7+
trunk:
8+
name: Push to trunk
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@master
12+
- name: WordPress.org plugin asset/readme update
13+
uses: 10up/action-wordpress-plugin-asset-update@stable
14+
env:
15+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
16+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}

0 commit comments

Comments
 (0)