Skip to content

Commit b088735

Browse files
committed
Adapt plugin to WP-Stateless 4.0.0, prepare for publishing
1 parent 09a2a26 commit b088735

File tree

10 files changed

+264
-50
lines changed

10 files changed

+264
-50
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Publish Release
2+
run-name: Publish Release
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
release:
8+
description: 'Release version (e.g. 1.2.3)'
9+
required: true
10+
11+
permissions:
12+
contents: write
13+
14+
env:
15+
TAG: ${{ github.event.inputs.release }}
16+
BRANCH: temp-release-${{ github.event.inputs.release }}
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
# ref and repository are required, otherwise repo could appear in detached head state
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.head_ref }}
27+
repository: ${{ github.repository }}
28+
29+
- name: Parse Changelog Entries
30+
uses: actions/github-script@v7
31+
id: changelog
32+
with:
33+
script: |
34+
const { open } = require('fs/promises');
35+
36+
const version = process.env.TAG;
37+
const delimiter = '#### ';
38+
const file = await open('./changes.md');
39+
40+
let description = [];
41+
let found = false;
42+
43+
for await (let line of file.readLines()) {
44+
line = line.trim();
45+
46+
if ( line.startsWith(`${delimiter}${version}`) ) {
47+
found = true;
48+
continue;
49+
}
50+
51+
if (!found) continue;
52+
if ( line.startsWith(delimiter) ) break;
53+
54+
description.push(line);
55+
}
56+
57+
if ( !description.length ) core.setFailed(`Release ${version} not found in the changelog!`);
58+
59+
core.setOutput('description', description.join('\n') );
60+
61+
62+
# cleanup files that are not needed for the release
63+
# but keep the .git folder, because we need it for the next step
64+
- name: Cleanup files
65+
run: |
66+
rm -f composer.lock || true
67+
rm -rf tests || true
68+
rm -rf vendor/composer/installers || true
69+
find ./ -name '.git*' -not -path './.git' -type f -delete || true
70+
find ./ -name '.git*' -not -path './.git' -type d -exec rm -rf {} \; || true
71+
find ./vendor -name .svn -exec rm -rf {} \; || true
72+
73+
# cleanup files, specific to Google API PHP library
74+
- name: Cleanup files for Google API library
75+
run: |
76+
rm -f lib/Google/phpstan.neon.dist || true
77+
rm -f lib/Google/vendor/paragonie/random_compat/build-phar.sh || true
78+
find ./lib/Google/ -name '.repo-metadata.json' -type f -delete || true
79+
find ./lib/Google/vendor -name .svn -exec rm -rf '{}' \; || true
80+
81+
# commit changes to temporary release branch and create a new tag
82+
- name: Commit changes
83+
uses: EndBug/add-and-commit@v9
84+
with:
85+
message: Cleanup files for release
86+
new_branch: ${{ env.BRANCH }}
87+
tag: ${{ env.TAG }}
88+
89+
# generate SBOM that will be attached to a release as an artifact
90+
- name: Create SBOM
91+
id: sbom
92+
uses: anchore/sbom-action@v0
93+
with:
94+
path: .
95+
output-file: sbom.spdx.json
96+
format: spdx-json
97+
98+
# create a draft release with the version changelog as a description
99+
- name: Create Draft Release
100+
id: draft_release
101+
uses: softprops/action-gh-release@v1
102+
with:
103+
name: "Release ${{ env.TAG }}"
104+
body: "${{ steps.changelog.outputs.description }}"
105+
tag_name: ${{ env.TAG }}
106+
draft: true
107+
prerelease: false
108+
109+
# attach SBOM to release
110+
- name: Upload SBOM to release
111+
uses: actions/upload-release-asset@v1.0.2
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
with:
115+
upload_url: ${{ steps.draft_release.outputs.upload_url }}
116+
asset_path: ./sbom.spdx.json
117+
asset_name: sbom.spdx.json
118+
asset_content_type: application/json
119+
120+
# publish release using an ID from the 'draft_release' step
121+
- name: Publish Release
122+
uses: eregon/publish-release@v1
123+
env:
124+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
with:
126+
release_id: ${{ steps.draft_release.outputs.id }}
127+
128+
# delete temporary release branch
129+
- name: Delete temporary release branch
130+
run: |
131+
git push origin --delete ${{ env.BRANCH }}

.github/workflows/tests.yml

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,30 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main ]
65
pull_request:
7-
branches: [ main ]
86

97
jobs:
108
build:
11-
129
runs-on: ubuntu-latest
1310

1411
steps:
15-
- uses: actions/checkout@v2
16-
17-
- name: Validate composer.json and composer.lock
18-
run: composer validate
19-
20-
- name: Cache Composer packages
21-
id: composer-cache
22-
uses: actions/cache@v2
23-
with:
24-
path: vendor
25-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
26-
restore-keys: |
27-
${{ runner.os }}-php-
28-
29-
- name: Install dependencies
30-
if: steps.composer-cache.outputs.cache-hit != 'true'
31-
run: composer install --prefer-dist --no-progress --no-suggest
32-
33-
- name: Run test suite
34-
run: composer test
12+
- uses: actions/checkout@v2
13+
14+
- name: Validate composer.json and composer.lock
15+
run: composer validate
16+
17+
- name: Cache Composer packages
18+
id: composer-cache
19+
uses: actions/cache@v2
20+
with:
21+
path: vendor
22+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
23+
restore-keys: |
24+
${{ runner.os }}-php-
25+
26+
- name: Install dependencies
27+
if: steps.composer-cache.outputs.cache-hit != 'true'
28+
run: composer install --prefer-dist --no-progress
29+
30+
- name: Run test suite
31+
run: composer test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Provides compatibility between the [LiteSpeed Cache](https://wordpress.org/plugi
1111

1212
### Notes
1313

14-
* Tested with LiteSpeed Cache plugin version 5.7.0.1
14+
* Tested with LiteSpeed Cache plugin version 6.1
1515

1616
### Support, Feedback, & Contribute
1717

SECURITY.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Security Policy Overview
2+
3+
Thank you for using and contributing to our product. At [UDX](https://udx.io), we take the security of our products seriously and appreciate collaborative efforts to ensure the safety of our users and contributors.
4+
5+
## Reporting a Security Vulnerability
6+
7+
**Please do not report security vulnerabilities through public GitHub issues.**
8+
9+
If you find a security vulnerability, please [submit a vulnerability report](https://github.com/udx/wp-stateless-litespeed-cache-addon/security/advisories/new). Provide detailed information about the vulnerability to help us understand and address the issue promptly. We kindly request that you avoid public disclosure until we've had the opportunity to analyze and resolve the reported issue.
10+
11+
## Responsible Disclosure
12+
13+
Responsible disclosure is crucial to maintaining the security of our product. We ask for your cooperation in allowing us sufficient time to investigate and address the reported vulnerability before making it public. We will keep you informed of our progress and make every effort to address the issue promptly.
14+
15+
## Supported Versions
16+
17+
Security updates are provided for the latest stable release. Please ensure that you are using a supported version before reporting a security vulnerability.
18+
19+
## Contact Information
20+
21+
For security-related matters, please contact our security team at [security@udx.io](mailto:security@udx.io). For general inquiries, feature requests, and other non-security-related discussions, please use our regular [issue tracker](https://github.com/udx/wp-stateless-litespeed-cache-addon/issues).
22+
23+
Thank you for helping us ensure the security of WP-Stateless - LiteSpeed Cache Addon. Your contributions are greatly appreciated.

0 commit comments

Comments
 (0)