-
Notifications
You must be signed in to change notification settings - Fork 13
153 lines (135 loc) · 5.73 KB
/
Copy pathplugins-release.yml
File metadata and controls
153 lines (135 loc) · 5.73 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Plugins Release
# Tag with `plugins-v0.1.0` (etc.) to cut a release. A GitHub Release is created
# with both installable zips attached. Marketplaces that expose a deploy API
# (WordPress.org) are pushed automatically; marketplaces without one
# (WooCommerce.com, WHMCS Marketplace) require a one-click manual upload of the
# release asset — the workflow summary links straight to it.
#
# Required / optional secrets:
# WP_ORG_SVN_USERNAME — (optional) WordPress.org SVN username. If set, the
# WooCommerce plugin is deployed to WordPress.org via
# SVN. Without it, the WP.org step is skipped.
# WP_ORG_SVN_PASSWORD — (optional) matching SVN password.
# WOOCOM_NOTIFY_WEBHOOK — (optional) Slack/Discord/email webhook URL that
# receives a reminder to upload to WooCommerce.com
# and WHMCS Marketplace.
on:
push:
tags:
- 'plugins-v*'
workflow_dispatch:
inputs:
version:
description: 'Version (e.g. 0.1.0) — used only for manual runs'
required: true
default: '0.1.0'
jobs:
build:
name: Build + verify
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: curl, hash, json
coverage: none
tools: none
- name: Derive version
id: meta
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
VERSION="${GITHUB_REF_NAME#plugins-v}"
else
VERSION="${INPUT_VERSION}"
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Building plugins version ${VERSION}"
- name: Run webhook contract tests
run: php packages/coinpay-php/tests/WebhookTest.php
- name: Run client integration tests
run: php packages/coinpay-php/tests/ClientTest.php
- name: Build zips
env:
COINPAY_PLUGIN_VERSION: ${{ steps.meta.outputs.version }}
run: ./scripts/build-plugin-zips.sh
- uses: actions/upload-artifact@v4
with:
name: plugin-zips
path: dist/coinpay-*.zip
retention-days: 90
github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: plugin-zips
path: dist
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('plugins-v{0}', needs.build.outputs.version) }}
name: CoinPay Plugins ${{ needs.build.outputs.version }}
body: |
CoinPay for WooCommerce and CoinPay for WHMCS — version ${{ needs.build.outputs.version }}.
## Downloads
- `coinpay-woocommerce-${{ needs.build.outputs.version }}.zip` — install via WordPress → Plugins → Add New → Upload Plugin.
- `coinpay-whmcs-${{ needs.build.outputs.version }}.zip` — unzip into your WHMCS install root.
## Distribution status
- [x] GitHub Release assets (you are here)
- [ ] WordPress.org plugin directory (SVN deploy — runs automatically when `WP_ORG_SVN_USERNAME` is configured)
- [ ] WooCommerce.com Marketplace — **manual upload required** (no public API). Vendor dashboard: https://woocommerce.com/my-dashboard/
- [ ] WHMCS Marketplace — **manual upload required** (no public API). Vendor dashboard: https://marketplace.whmcs.com/
files: dist/coinpay-*.zip
generate_release_notes: true
wordpress-org-deploy:
name: Deploy to WordPress.org
runs-on: ubuntu-latest
needs: build
# Only attempt WP.org deploy when the SVN credentials are configured.
# Repo variable `WP_ORG_DEPLOY_ENABLED=true` gates this even if secrets exist.
if: vars.WP_ORG_DEPLOY_ENABLED == 'true'
steps:
- uses: actions/checkout@v4
- name: Prepare plugin dir
run: |
mkdir -p _deploy
cp -r plugins/woocommerce/coinpay-woocommerce/* _deploy/
ls -la _deploy
- name: Deploy to WordPress.org SVN
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_USERNAME: ${{ secrets.WP_ORG_SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.WP_ORG_SVN_PASSWORD }}
SLUG: coinpay-woocommerce
VERSION: ${{ needs.build.outputs.version }}
BUILD_DIR: ./_deploy
# ASSETS_DIR: ./plugins/woocommerce/.wordpress-org # add if/when we ship banners/icons
notify-marketplaces:
name: Notify maintainer of manual uploads
runs-on: ubuntu-latest
needs: [build, github-release]
if: vars.NOTIFY_MARKETPLACES == 'true'
steps:
- name: Post marketplace reminder
env:
NOTIFY_URL: ${{ secrets.MARKETPLACE_NOTIFY_WEBHOOK }}
VERSION: ${{ needs.build.outputs.version }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [ -z "${NOTIFY_URL:-}" ]; then
echo "MARKETPLACE_NOTIFY_WEBHOOK not set — skipping."
exit 0
fi
curl -fsS -X POST -H 'Content-Type: application/json' \
-d "{\"text\": \"CoinPay plugins v${VERSION} built. Manual upload needed:\\n• WooCommerce.com: https://woocommerce.com/my-dashboard/\\n• WHMCS Marketplace: https://marketplace.whmcs.com/\\nArtifacts: ${RUN_URL}\"}" \
"${NOTIFY_URL}"