-
Notifications
You must be signed in to change notification settings - Fork 2
122 lines (102 loc) · 3.25 KB
/
release.yml
File metadata and controls
122 lines (102 loc) · 3.25 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
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: "write"
jobs:
tests:
name: Release tests
uses: ./.github/workflows/tests.yml
build:
name: Build client
runs-on: ubuntu-latest
needs: tests
steps:
- name: Setup node
uses: actions/setup-node@v6
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Replace textdomains
run: find src -exec sed -i "s/http-bridge/forms-bridge/g" {} \;
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build
path: forms-bridge/assets/plugin.bundle.js
package:
name: Prepare package
runs-on: ubuntu-latest
container:
image: codeccoop/wp-cli
env:
ZIP: "${{ github.ref_name }}.zip"
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v6
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build
path: forms-bridge/assets
- name: Install dist archive
run: wp package install wp-cli/dist-archive-command:3.1.0
- name: Replace textdomains
run: |
find forms-bridge/deps/plugin -name '*.php' -exec sed -i "s/wpct-plugin/forms-bridge/g" {} \;
find forms-bridge -name '*.php' -exec sed -i "s/wpct_plugin_/forms_bridge_plugin_/g" {} \;
find forms-bridge -name "*.php" -exec sed -i 's/WPCT_PLUGIN/FORMS_BRIDGE\\Plugin/g' {} \;
find forms-bridge/deps/http -name '*.php' -exec sed -i "s/http-bridge/forms-bridge/g" {} \;
find forms-bridge -name '*.php' -exec sed -i "s/http_bridge_/forms_bridge_http_/g" {} \;
find forms-bridge -name "*.php" -exec sed -i 's/HTTP_BRIDGE_/FORMS_BRIDGE_HTTP_/g' {} \;
find forms-bridge -name '*.php' -exec sed -i 's/HTTP_BRIDGE/FORMS_BRIDGE\\Http/g' {} \;
- name: Distignore
run: cp .distignore forms-bridge
- name: Archive
run: wp dist-archive forms-bridge ./"$ZIP"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: plugin-archive
path: ${{ env.ZIP }}
release:
name: Release pushed tag
runs-on: ubuntu-latest
needs: package
env:
ZIP: "${{ github.ref_name }}.zip"
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: plugin-archive
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
mv $ZIP forms-bridge.zip
gh release create "$TAG" \
--repo="$GITHUB_REPOSITORY" \
--title="$TAG" \
--generate-notes \
"forms-bridge.zip"