Skip to content

Commit 08e8ea3

Browse files
committed
Merge branch 'main' into rishad-dev-tmp
2 parents ab40ad5 + 2bf5de2 commit 08e8ea3

File tree

3 files changed

+136
-0
lines changed

3 files changed

+136
-0
lines changed

.github/build

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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-integrations";
8+
BUILD_DIR="$PLUGIN_DIR/build/bit-integrations";
9+
10+
if [ ! -d "$PLUGIN_DIR/languages" ]; then
11+
mkdir "$PLUGIN_DIR/languages";
12+
fi
13+
14+
composer i -o --no-dev --ignore-platform-reqs 2>&1 >/dev/null
15+
16+
cd "$PLUGIN_DIR/frontend-dev" && pnpm pda
17+
18+
cd "$PLUGIN_DIR"
19+
20+
cp -r "$PLUGIN_DIR/assets" "$BUILD_DIR/assets"
21+
cp -r "$PLUGIN_DIR/bitwpfi.php" "$BUILD_DIR/bitwpfi.php"
22+
cp -r "$PLUGIN_DIR/build-hash.txt" "$BUILD_DIR/build-hash.txt"
23+
cp -r "$PLUGIN_DIR/composer.json" "$BUILD_DIR/composer.json"
24+
cp -r "$PLUGIN_DIR/includes" "$BUILD_DIR/includes"
25+
cp -r "$PLUGIN_DIR/languages" "$BUILD_DIR/languages"
26+
cp -r "$PLUGIN_DIR/readme.txt" "$BUILD_DIR/readme.txt"
27+
cp -r "$PLUGIN_DIR/vendor" "$BUILD_DIR/vendor"
28+
cp -r "$PLUGIN_DIR/views" "$BUILD_DIR/views"

.github/workflows/deploy.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Deploy to WordPress.org Repository
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
release:
8+
types: [released]
9+
10+
jobs:
11+
deploy_to_wp_repository:
12+
name: Deploy to WP.org
13+
runs-on: ubuntu-latest
14+
env:
15+
PLUGIN_SLUG: bit-integrations
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Install pnpm
21+
uses: pnpm/action-setup@v4
22+
with:
23+
version: 9
24+
run_install: false
25+
26+
- name: Setup Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
cache: "pnpm"
31+
cache-dependency-path: "frontend-dev/pnpm-lock.yaml"
32+
33+
- name: Get pnpm store directory
34+
id: pnpm-cache
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38+
39+
- uses: actions/cache@v3
40+
name: Setup pnpm cache
41+
with:
42+
path: ${{ env.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
- name: Install frontend dependencies
48+
run: |
49+
cd frontend-dev
50+
pnpm install
51+
52+
- name: Check for SVN
53+
id: check_svn
54+
run: |
55+
if ! command -v svn &> /dev/null; then
56+
echo "SVN not found, installing..."
57+
sudo apt-get update
58+
sudo apt-get install -y subversion
59+
else
60+
echo "SVN is already installed."
61+
fi
62+
63+
- name: Setup PHP
64+
id: setup-php
65+
uses: shivammathur/setup-php@v2
66+
with:
67+
php-version: "8.x"
68+
tools: composer:v2, wp-cli
69+
70+
- name: Determine if this is a release or push
71+
id: set-test-action
72+
run: |
73+
if [[ "${{ github.event_name }}" == "release" ]]; then
74+
echo "TEST_ACTION=false" >> $GITHUB_ENV
75+
else
76+
echo "TEST_ACTION=true" >> $GITHUB_ENV
77+
fi
78+
79+
- name: Build
80+
id: build-plugin
81+
run: |
82+
bash .github/build
83+
if [ -d "${{ github.workspace }}/build/${{ env.PLUGIN_SLUG }}" ]; then
84+
echo "free_exists=true" >> "${GITHUB_OUTPUT}"
85+
else
86+
echo "free_exists=false" >> "${GITHUB_OUTPUT}"
87+
fi
88+
89+
- name: WordPress Plugin Deploy
90+
if: steps.build-plugin.outputs.free_exists == 'true'
91+
id: deploy
92+
uses: 10up/action-wordpress-plugin-deploy@stable
93+
with:
94+
generate-zip: true
95+
dry-run: ${{ env.TEST_ACTION }}
96+
env:
97+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
98+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
99+
BUILD_DIR: "${{ github.workspace }}/build/${{ env.PLUGIN_SLUG }}"
100+
SLUG: ${{ env.PLUGIN_SLUG }}
101+
- name: Upload release asset
102+
if: steps.build-plugin.outputs.free_exists == 'true'
103+
uses: softprops/action-gh-release@v2
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
with:
107+
files: ${{ steps.deploy.outputs['zip-path'] }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ yarn-error.log
1414

1515
.php-cs-fixer.cache
1616
build-hash.txt
17+
build/

0 commit comments

Comments
 (0)