Skip to content

Commit ceefe17

Browse files
Ghost CompilerGhost Compiler
authored andcommitted
Repush library due to some account issue
0 parents  commit ceefe17

75 files changed

Lines changed: 12696 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
12+
13+
jobs:
14+
test-and-package:
15+
name: Test and package extension
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: "24"
26+
27+
- name: Install tools
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y php-cli php-xml zip unzip libxml2-utils
31+
32+
- name: Install frontend dependencies
33+
run: |
34+
if [ -f package-lock.json ]; then
35+
npm ci --ignore-scripts --legacy-peer-deps
36+
else
37+
npm install --ignore-scripts --legacy-peer-deps
38+
fi
39+
40+
- name: Validate PHP syntax
41+
run: |
42+
find plib htdocs \( -name '*.php' -o -name '*.phtml' \) -print0 \
43+
| sort -z \
44+
| xargs -0 -n1 php -l
45+
46+
- name: Run frontend and docs tests
47+
run: npm test
48+
49+
- name: Validate extension metadata
50+
run: |
51+
xmllint --noout meta.xml
52+
php -r '
53+
$xml = simplexml_load_file("meta.xml");
54+
if (!$xml) {
55+
fwrite(STDERR, "meta.xml is not valid XML\n");
56+
exit(1);
57+
}
58+
foreach (["id", "name", "version", "vendor"] as $field) {
59+
if (trim((string) $xml->{$field}) === "") {
60+
fwrite(STDERR, "Missing meta.xml field: {$field}\n");
61+
exit(1);
62+
}
63+
}
64+
echo "Extension: " . (string) $xml->name . " v" . (string) $xml->version . PHP_EOL;
65+
'
66+
node -e "JSON.parse(require('fs').readFileSync('packaging/manifest.json', 'utf8'))"
67+
68+
- name: Validate packaging script
69+
run: sh -n packaging/build.sh
70+
71+
- name: Build Plesk extension ZIP
72+
run: |
73+
sh packaging/build.sh
74+
version="$(php -r '$xml = simplexml_load_file("meta.xml"); echo trim((string) $xml->version);')"
75+
zip -T "cloudflare-pro-${version}.zip"
76+
cp "cloudflare-pro-${version}.zip" cloudflare-pro.zip
77+
78+
- name: Upload package artifact
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: cloudflare-pro-package
82+
path: |
83+
cloudflare-pro-*.zip
84+
cloudflare-pro.zip
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Package Latest
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
14+
15+
concurrency:
16+
group: package-latest
17+
cancel-in-progress: false
18+
19+
jobs:
20+
package-latest:
21+
name: Build latest install package
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: "24"
34+
35+
- name: Install tools
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y php-cli php-xml zip unzip libxml2-utils
39+
gh --version
40+
41+
- name: Install frontend dependencies
42+
run: |
43+
if [ -f package-lock.json ]; then
44+
npm ci --ignore-scripts --legacy-peer-deps
45+
else
46+
npm install --ignore-scripts --legacy-peer-deps
47+
fi
48+
49+
- name: Read extension version
50+
id: version
51+
run: |
52+
version="$(php -r '$xml = simplexml_load_file("meta.xml"); echo trim((string) $xml->version);')"
53+
if [ -z "$version" ]; then
54+
echo "Unable to read version from meta.xml" >&2
55+
exit 1
56+
fi
57+
echo "version=$version" >> "$GITHUB_OUTPUT"
58+
59+
- name: Validate package inputs
60+
run: |
61+
find plib htdocs \( -name '*.php' -o -name '*.phtml' \) -print0 \
62+
| sort -z \
63+
| xargs -0 -n1 php -l
64+
npm test
65+
xmllint --noout meta.xml
66+
node -e "JSON.parse(require('fs').readFileSync('packaging/manifest.json', 'utf8'))"
67+
sh -n packaging/build.sh
68+
69+
- name: Build latest ZIP
70+
run: |
71+
version="${{ steps.version.outputs.version }}"
72+
sh packaging/build.sh
73+
zip -T "cloudflare-pro-${version}.zip"
74+
cp "cloudflare-pro-${version}.zip" cloudflare-pro.zip
75+
76+
- name: Prepare latest release notes
77+
run: |
78+
cat > latest-release-notes.md <<EOF
79+
Rolling latest package for Cloudflare Pro.
80+
81+
Version: ${{ steps.version.outputs.version }}
82+
Commit: ${GITHUB_SHA}
83+
84+
Install with:
85+
86+
\`\`\`sh
87+
plesk bin extension --install-url https://github.com/${GITHUB_REPOSITORY}/releases/download/latest/cloudflare-pro.zip
88+
\`\`\`
89+
EOF
90+
91+
- name: Move latest tag
92+
run: |
93+
git config user.name "github-actions[bot]"
94+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
95+
git tag -f latest "$GITHUB_SHA"
96+
git push origin refs/tags/latest --force
97+
98+
- name: Publish latest package
99+
env:
100+
GH_TOKEN: ${{ github.token }}
101+
run: |
102+
version="${{ steps.version.outputs.version }}"
103+
title="Cloudflare Pro latest (v${version})"
104+
if gh release view latest >/dev/null 2>&1; then
105+
gh release upload latest cloudflare-pro.zip --clobber
106+
gh release edit latest --title "$title" --notes-file latest-release-notes.md --prerelease
107+
else
108+
gh release create latest cloudflare-pro.zip \
109+
--title "$title" \
110+
--notes-file latest-release-notes.md \
111+
--prerelease
112+
fi

.github/workflows/pages.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "README.md"
10+
- "scripts/validate-docs.cjs"
11+
- ".github/workflows/pages.yml"
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
pages: write
17+
id-token: write
18+
19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
21+
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: true
25+
26+
jobs:
27+
deploy:
28+
name: Deploy GitHub Pages docs
29+
runs-on: ubuntu-latest
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Pages
39+
uses: actions/configure-pages@v5
40+
with:
41+
enablement: true
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: "24"
47+
48+
- name: Validate documentation
49+
run: node scripts/validate-docs.cjs
50+
51+
- name: Upload Pages artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: docs
55+
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Release tag, for example v1.0.4"
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: write
16+
17+
env:
18+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
19+
20+
jobs:
21+
release:
22+
name: Build and publish release
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: "24"
33+
34+
- name: Install tools
35+
run: |
36+
sudo apt-get update
37+
sudo apt-get install -y php-cli php-xml zip unzip libxml2-utils
38+
gh --version
39+
40+
- name: Install frontend dependencies
41+
run: |
42+
if [ -f package-lock.json ]; then
43+
npm ci --ignore-scripts --legacy-peer-deps
44+
else
45+
npm install --ignore-scripts --legacy-peer-deps
46+
fi
47+
48+
- name: Resolve release version
49+
id: version
50+
run: |
51+
meta_version="$(php -r '$xml = simplexml_load_file("meta.xml"); echo trim((string) $xml->version);')"
52+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
53+
tag="${{ inputs.tag }}"
54+
else
55+
tag="${GITHUB_REF_NAME}"
56+
fi
57+
tag_version="${tag#v}"
58+
if [ "$meta_version" != "$tag_version" ]; then
59+
echo "meta.xml version ($meta_version) must match release tag ($tag)." >&2
60+
exit 1
61+
fi
62+
echo "version=$meta_version" >> "$GITHUB_OUTPUT"
63+
echo "tag=v$meta_version" >> "$GITHUB_OUTPUT"
64+
65+
- name: Validate package inputs
66+
run: |
67+
find plib htdocs \( -name '*.php' -o -name '*.phtml' \) -print0 \
68+
| sort -z \
69+
| xargs -0 -n1 php -l
70+
npm test
71+
xmllint --noout meta.xml
72+
node -e "JSON.parse(require('fs').readFileSync('packaging/manifest.json', 'utf8'))"
73+
sh -n packaging/build.sh
74+
75+
- name: Build release ZIP asset
76+
run: |
77+
version="${{ steps.version.outputs.version }}"
78+
sh packaging/build.sh
79+
zip -T "cloudflare-pro-${version}.zip"
80+
81+
- name: Generate release notes
82+
run: |
83+
awk 'NR == 1 { next } /^## / && seen { exit } /^## / { seen = 1; next } seen { print }' CHANGES.md > release-notes.md
84+
if [ ! -s release-notes.md ]; then
85+
echo "Cloudflare Pro ${{ steps.version.outputs.tag }}" > release-notes.md
86+
fi
87+
88+
- name: Publish GitHub release
89+
env:
90+
GH_TOKEN: ${{ github.token }}
91+
run: |
92+
tag="${{ steps.version.outputs.tag }}"
93+
version="${{ steps.version.outputs.version }}"
94+
if gh release view "$tag" >/dev/null 2>&1; then
95+
gh release upload "$tag" "cloudflare-pro-${version}.zip" --clobber
96+
else
97+
gh release create "$tag" "cloudflare-pro-${version}.zip" \
98+
--title "$tag" \
99+
--notes-file release-notes.md
100+
fi

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
.DS_Store
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
cloudflare-pro-1.0.0-1.zip

0 commit comments

Comments
 (0)