-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (79 loc) · 2.98 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (79 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Release
# When you publish a GitHub Release this workflow:
# 1. builds the installable plugin zip (bin/build-zip.sh - committed files
# minus .distignore) and attaches it to that release;
# 2. pushes that version to the WordPress.org plugin SVN repo and updates
# the .org readme and listing assets.
#
# Nothing is committed back to the repo. The SVN steps need the repo secrets
# SVN_USERNAME and SVN_PASSWORD (your WordPress.org account) and only run for
# real Release events, not workflow_dispatch.
#
# The deploy / assets jobs are gated on a repo *variable* DEPLOY_TO_WPORG=true
# (Settings -> Secrets and variables -> Actions -> Variables). Until you set it
# (and after the first .org review is approved), only the zip job runs - so a
# Release on a not-yet-published plugin is still green. Or just delete the two
# jobs.
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Existing tag to build and attach the zip to"
required: true
permissions:
contents: write
jobs:
zip:
name: Attach plugin zip to release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
- name: Build zip
run: bin/build-zip.sh
- name: Check version matches the tag
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
TAG="${TAG#v}"
VER="$(grep -oE "Version:[[:space:]]*[0-9.]+" perxel-example.php | grep -oE "[0-9.]+")"
echo "tag=$TAG plugin version=$VER"
if [ "$TAG" != "$VER" ]; then
echo "::error::Tag ($TAG) does not match the plugin Version header ($VER). Bump the version before tagging."
exit 1
fi
- name: Upload to the release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.release.tag_name || github.event.inputs.tag }}
files: dist/perxel-example.zip
fail_on_unmatched_files: true
deploy:
name: Deploy to WordPress.org
if: github.event_name == 'release' && vars.DEPLOY_TO_WPORG == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: WordPress.org plugin deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: perxel-example
assets:
name: Update readme and assets
if: github.event_name == 'release' && vars.DEPLOY_TO_WPORG == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update WordPress.org readme and assets
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SLUG: perxel-example