Skip to content

Commit f4fde4f

Browse files
committed
Merge branch 'master' into tests
2 parents b427096 + a3ca59f commit f4fde4f

5 files changed

Lines changed: 163 additions & 272 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: PrestaShop Validator
2+
on: [push]
3+
4+
jobs:
5+
prestashop-validator:
6+
runs-on: ubuntu-latest
7+
8+
steps:
9+
- name: Checkout code
10+
id: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Install Bun
14+
uses: oven-sh/setup-bun@v2
15+
16+
- name: Install PHP ${{ env.PHP_VERSION || '7.4' }}
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ env.PHP_VERSION || '7.4' }}
20+
tools: composer
21+
22+
- name: Build module
23+
id: build
24+
run: |
25+
bun install
26+
bun run build:zip
27+
zip=`basename -- $(find ./dist/ -name "prestashopvite_*.zip")`
28+
29+
echo "zip=$zip" >> $GITHUB_OUTPUT
30+
echo "$zip"
31+
32+
- name: Validate module
33+
id: validate
34+
env:
35+
PS_VALIDATOR_KEY: ${{ secrets.PRESTASHOP_VALIDATOR_API_KEY }}
36+
if: env.PS_VALIDATOR_KEY
37+
uses: cssnr/web-request-action@v2
38+
with:
39+
url: "https://validator.prestashop.com/api/modules"
40+
method: "POST"
41+
params: |
42+
{
43+
"key": ${{ env.PS_VALIDATOR_KEY }}
44+
}
45+
file: ./dist/${{ steps.build.outputs.zip }}
46+
name: archive
47+
48+
- name: Save validator output to file
49+
id: parse
50+
env:
51+
VALIDATOR_JSON: ${{ steps.validate.outputs.data }}
52+
run: |
53+
mkdir -p artifacts
54+
55+
printf '%s' "$VALIDATOR_JSON" > artifacts/response.json
56+
57+
ERRORS_TOTAL=$(jq '.Details.results.errors // 0' artifacts/response.json)
58+
ERRORS=$(jq '.Errors' artifacts/response.json)
59+
60+
echo "errors_total=$ERRORS_TOTAL" >> "$GITHUB_OUTPUT"
61+
echo "$ERRORS" > artifacts/errors.json
62+
63+
- name: Upload validation artifact
64+
uses: actions/upload-artifact@v6
65+
with:
66+
name: prestashop-validator
67+
path: artifacts/
68+
retention-days: 10
69+
70+
- name: Check validation results
71+
id: check
72+
run: |
73+
ERRORS="${{ steps.parse.outputs.ERRORS_TOTAL }}"
74+
if [ "$ERRORS" -gt 1 ]; then
75+
echo "❌ Validator found $((ERRORS - 1)) error/s"
76+
exit 1
77+
fi
78+
echo "✅ Module passed validation"

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release and upload
2+
on:
3+
workflow_dispatch: {}
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
tag:
13+
name: Create new release
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
id: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install Bun
22+
uses: oven-sh/setup-bun@v2
23+
24+
- name: Install PHP ${{ env.PHP_VERSION || '7.4' }}
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ env.PHP_VERSION || '7.4' }}
28+
tools: composer
29+
30+
- name: Build module
31+
id: build
32+
run: |
33+
bun install
34+
bun run build:zip
35+
zip=`basename -- $(find ./dist/ -name "prestashopvite_*.zip")`
36+
37+
echo "zip=$zip" >> $GITHUB_OUTPUT
38+
echo "$zip"
39+
40+
- name: Upload plugin on GitHub
41+
id: upload-github
42+
uses: softprops/action-gh-release@v2
43+
with:
44+
files: ./dist/${{ steps.build.outputs.zip }}

0 commit comments

Comments
 (0)