Skip to content

Commit 45acdf0

Browse files
authored
Merge pull request #18 from Bit-Apps-Pro/feat/log
Feat/log
2 parents 8861b7c + 3d436a0 commit 45acdf0

File tree

98 files changed

+7498
-6195
lines changed

Some content is hidden

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

98 files changed

+7498
-6195
lines changed

.github/copy-assets

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env /usr/bin/bash
2+
3+
PLUGIN_DIR="$PWD"
4+
5+
6+
rm -rf "$PLUGIN_DIR/build";
7+
mkdir -p "$PLUGIN_DIR/build/bit-smtp";
8+
BUILD_DIR="$PLUGIN_DIR/build/bit-smtp";
9+
10+
cd "$PLUGIN_DIR"
11+
12+
cp -r "$PLUGIN_DIR/bit_smtp.php" "$BUILD_DIR/bit_smtp.php"
13+
14+
cp -r "$PLUGIN_DIR/assets" "$BUILD_DIR/assets"
15+
cp -r "$PLUGIN_DIR/vendor" "$BUILD_DIR/vendor"
16+
cp -r "$PLUGIN_DIR/backend" "$BUILD_DIR/backend"
17+
cp -r "$PLUGIN_DIR/languages" "$BUILD_DIR/languages"
18+
cp -r "$PLUGIN_DIR/readme.txt" "$BUILD_DIR/readme.txt"
19+
cp -r "$PLUGIN_DIR/composer.json" "$BUILD_DIR/composer.json"

.github/workflows/deploy.yml

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,105 @@
11
name: Deploy to WordPress.org Repository
2+
23
on:
34
release:
45
types: [released]
6+
57
jobs:
68
deploy_to_wp_repository:
79
name: Deploy to WP.org
810
runs-on: ubuntu-latest
911
env:
1012
PLUGIN_SLUG: bit-smtp
11-
DRY_RUN: false
12-
1313
steps:
1414
- name: Checkout code
1515
uses: actions/checkout@v4
1616

17+
- name: Setup PHP
18+
id: setup-php
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.x'
22+
tools: composer:v2, wp-cli
23+
1724
- name: Setup Node
1825
uses: actions/setup-node@v4
1926
with:
20-
node-version: 20
27+
node-version: 22
2128

2229
- name: Install pnpm
2330
uses: pnpm/action-setup@v4
2431
with:
25-
version: 9
32+
run_install: false
2633

2734
- name: Get pnpm store directory
2835
id: pnpm-cache
2936
shell: bash
3037
run: |
31-
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
32-
33-
- uses: actions/cache@v3
34-
name: Setup pnpm cache
35-
with:
36-
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
37-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38-
restore-keys: |
39-
${{ runner.os }}-pnpm-store-
40-
41-
- name: Install frontend dependencies
42-
run: pnpm install
38+
echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
4339
44-
- name: Setup PHP
45-
id: setup-php
46-
uses: shivammathur/setup-php@v2
47-
with:
48-
php-version: '7.x'
49-
tools: composer:v2, wp-cli
50-
51-
- name: Get Composer cache directory
40+
- name: Get composer cache directory
5241
id: composer-cache
53-
shell: bash
54-
run: |
55-
echo "COMPOSER_CACHE_PATH=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
42+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
5643

57-
- uses: actions/cache@v3
58-
name: Setup composer cache
44+
- uses: actions/cache@v4
45+
name: Setup package cache
5946
with:
60-
path: ${{ steps.composer-cache.outputs.COMPOSER_CACHE_PATH }}
61-
key: ${{ runner.os }}-composer-cache-${{ hashFiles('**/composer.lock') }}
47+
path: |
48+
${{ steps.pnpm-cache.outputs.dir }}
49+
${{ steps.composer-cache.outputs.dir }}
50+
key: ${{ runner.os }}-cached-package-${{ hashFiles('**/pnpm-lock.yaml', '**/composer.lock') }}
6251
restore-keys: |
63-
${{ runner.os }}-composer-cache-
52+
${{ runner.os }}-cached-package-
53+
54+
- name: Check for SVN
55+
id: check_svn
56+
run: |
57+
if ! command -v svn &> /dev/null; then
58+
echo "SVN not found, installing..."
59+
sudo apt-get update
60+
sudo apt-get install -y subversion
61+
else
62+
echo "SVN is already installed."
63+
fi
6464
65-
- name: Install php dependencies
66-
run: composer i --no-dev --optimize-autoloader
65+
- name: Determine if this is a release or push
66+
id: set-test-action
67+
run: |
68+
if [[ "${{ github.event_name }}" == "release" ]]; then
69+
echo "TEST_ACTION=false" >> $GITHUB_ENV
70+
else
71+
echo "TEST_ACTION=true" >> $GITHUB_ENV
72+
fi
6773
6874
- name: Build
6975
id: build-plugin
7076
run: |
7177
pnpm build
7278
pnpm i18n:parse-js
7379
pnpm i18n:php
80+
bash .github/copy-assets
81+
82+
if [ -d "${{ github.workspace }}/build/${{ env.PLUGIN_SLUG }}" ]; then
83+
echo "free_exists=true" >> "${GITHUB_OUTPUT}"
84+
else
85+
echo "free_exists=false" >> "${GITHUB_OUTPUT}"
86+
fi
7487
7588
- name: WordPress Plugin Deploy
89+
if: steps.build-plugin.outputs.free_exists == 'true'
7690
id: deploy
7791
uses: 10up/action-wordpress-plugin-deploy@stable
7892
with:
7993
generate-zip: true
80-
dry-run: ${{ env.DRY_RUN }}
94+
dry-run: ${{ env.TEST_ACTION }}
8195
env:
8296
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
8397
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
98+
BUILD_DIR: '${{ github.workspace }}/build/${{ env.PLUGIN_SLUG }}'
8499
SLUG: ${{ env.PLUGIN_SLUG }}
85100

86101
- name: Upload release asset
102+
if: steps.build-plugin.outputs.free_exists == 'true'
87103
uses: softprops/action-gh-release@v2
88104
env:
89105
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-all.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Run Lefthook on Push
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'feature/*'
8+
- 'fix/*'
9+
10+
jobs:
11+
setup:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
20+
- name: Setup PHP
21+
id: setup-php
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.x'
25+
tools: composer:v2, wp-cli
26+
27+
- name: Setup Node
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 22
31+
32+
- name: Install pnpm
33+
uses: pnpm/action-setup@v4
34+
with:
35+
run_install: false
36+
37+
- name: Get pnpm store directory
38+
id: pnpm-cache
39+
shell: bash
40+
run: |
41+
echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
42+
43+
- name: Get composer cache directory
44+
id: composer-cache
45+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
46+
47+
- uses: actions/cache/restore@v4
48+
name: Restore package cache
49+
id: restore-package-cache
50+
with:
51+
path: |
52+
${{ steps.pnpm-cache.outputs.dir }}
53+
${{ steps.composer-cache.outputs.dir }}
54+
key: ${{ runner.os }}-cached-test-package-${{ hashFiles('**/pnpm-lock.yaml', '**/composer.lock') }}
55+
restore-keys: |
56+
${{ runner.os }}-cached-test-package-
57+
58+
- name: Install dependencies
59+
run: |
60+
composer install --prefer-dist --no-progress
61+
pnpm install
62+
63+
- uses: actions/cache/save@v4
64+
name: Save package cache
65+
if: always() && steps.restore-package-cache.outputs.cache-hit != 'true'
66+
with:
67+
key: ${{ steps.restore-package-cache.outputs.cache-primary-key }}
68+
path: |
69+
${{ steps.pnpm-cache.outputs.dir }}
70+
${{ steps.composer-cache.outputs.dir }}
71+
72+
- name: Run Lefthook
73+
run: pnpm lefthook run github-actions

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
vendor/
22
assets/
33
languages/
4-
node_modules
5-
dist
4+
node_modules/
5+
dist/
66
frontend/yarn-error.log
77
frontend/coverage/*
88
frontend/src/coverage/*
@@ -17,3 +17,5 @@ eslint-cache/
1717
locale.pot
1818
.vscode/settings.json
1919
package-lock.json
20+
port
21+
build/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
22

.wordpress-org/screenshot-1.png

57.9 KB
Loading

.wordpress-org/screenshot-2.png

95.1 KB
Loading

.wordpress-org/screenshot-3.png

-16.3 KB
Loading

.wordpress-org/screenshot-4.png

200 KB
Loading

.wordpress-org/screenshot-5.png

678 KB
Loading

0 commit comments

Comments
 (0)