Skip to content

Commit d55e67f

Browse files
Merge pull request #57 from brainstormforce/sync/from-uagb-master
Sync from ultimate-addons-for-gutenberg master
2 parents 590b149 + 90f541d commit d55e67f

50 files changed

Lines changed: 1243 additions & 73 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: Bug Title ...
5+
labels: "bug"
6+
assignees: ''
7+
---
8+
9+
### Describe the bug:
10+
<!-- A clear and concise description of what the bug is, using ISBAT format "I should be able to..." -->
11+
12+
### To reproduce:
13+
<!-- Steps to reproduce the behavior: -->
14+
15+
<!--
16+
1. Go to '...'
17+
2. Click on '....'
18+
3. Scroll down to '....'
19+
4. See error
20+
-->
21+
22+
### Expected behavior:
23+
<!-- A clear and concise description of what you expected to happen. -->
24+
25+
### Screenshots:
26+
<!-- If applicable, add screenshots to help explain your problem. -->
27+
28+
### Isolating the problem:
29+
<!-- Mark completed items with an [x]. -->
30+
31+
- [ ] This bug happens with no other plugins activated
32+
- [ ] This bug happens with a default WordPress theme active
33+
- [ ] This bug happens **without** the Gutenberg plugin active
34+
- [ ] I can reproduce this bug consistently using the steps above
35+
36+
### WordPress version:
37+
<!-- What version of WordPress are you using? -->
38+
39+
### Gutenberg version:
40+
<!-- if applicable -->
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: Feature Title ...
5+
labels: "enhancement"
6+
assignees: ''
7+
---
8+
9+
### Is your feature request related to a problem? Please describe.
10+
<!-- A clear and concise description of what the problem is, using ISBAT format "I should be able to..." -->
11+
12+
### Describe the solution you'd like
13+
<!-- A clear and concise description of what you want to happen. -->
14+
15+
### Describe alternatives you've considered
16+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
17+
18+
### Additional context/screenshots
19+
<!-- Add any other context or screenshots about the feature request here.-->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### Description
2+
<!-- Please describe what you have changed or added -->
3+
4+
### Screenshots
5+
<!-- if applicable -->
6+
7+
### Types of changes
8+
<!-- What types of changes does your code introduce? -->
9+
<!-- Bug fix (non-breaking change which fixes an issue) -->
10+
<!-- New feature (non-breaking change which adds functionality) -->
11+
<!-- Breaking change -->
12+
13+
### How has this been tested?
14+
<!-- Please describe in detail how you tested your changes. -->
15+
16+
### Checklist:
17+
- [ ] My code is tested
18+
- [ ] My code follows accessibility standards <!-- Guidelines: https://make.wordpress.org/core/handbook/best-practices/coding-standards/accessibility-coding-standards/ -->
19+
- [ ] My code has proper inline documentation <!-- Guidelines: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/javascript/ -->
20+
- [ ] I've included any necessary tests <!-- if applicable -->
21+
- [ ] I've included developer documentation <!-- if applicable -->
22+
- [ ] I've added proper labels to this pull request <!-- if applicable -->

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
github-actions:
9+
patterns: ["*"]
10+
11+
- package-ecosystem: "npm"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"
15+
groups:
16+
npm-dependencies:
17+
patterns: ["*"]
18+
19+
- package-ecosystem: "composer"
20+
directory: "/"
21+
schedule:
22+
interval: "weekly"
23+
groups:
24+
composer-dependencies:
25+
patterns: ["*"]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Simple Asset Size Reporter
2+
3+
# Run the deployment only when code is committed to the branch.
4+
on:
5+
pull_request:
6+
7+
# Cancels all previous workflow runs for pull requests that have not completed.
8+
concurrency:
9+
# The concurrency group contains the workflow name and the branch name for pull requests
10+
# or the commit hash for any other events.
11+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
assetSizeReporter:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 15
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Use desired version of NodeJS
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '16'
26+
cache: 'npm'
27+
28+
- uses: preactjs/compressed-size-action@v2
29+
with:
30+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
31+
install-script: "npm install --legacy-peer-deps"
32+
# Any JS files anywhere within a dist directory:
33+
pattern: "{assets/**/*.js,assets/**/*.css,dist/**/*.js,dist/**/*.css}"
34+
35+
# Always ignore SourceMaps and node_modules:
36+
exclude: "{**/*.map,**/node_modules/**}"
37+
# build-script: "dynamic-css"

.github/workflows/build-a-zip.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Build a zip, Comment on PR & Delete a zip on closed
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, ready_for_review, closed, labeled]
5+
branches:
6+
- master
7+
- dev
8+
- next-release
9+
- milestone
10+
paths:
11+
- "src/**"
12+
- "includes/**"
13+
- "ultimate-addons-for-gutenberg.php"
14+
- "package.json"
15+
- "package-lock.json"
16+
- "webpack.config.js"
17+
- ".github/workflows/build-a-zip.yml"
18+
19+
# Cancels all previous workflow runs for pull requests that have not completed.
20+
concurrency:
21+
# The concurrency group contains the workflow name and the branch name for pull requests
22+
# or the commit hash for any other events.
23+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
24+
cancel-in-progress: true
25+
26+
env:
27+
ZIP_URL: https://dev.ultimategutenberg.com/wp-content/uploads/uag-gh/
28+
PLUGIN_SLUG: ${{ github.event.repository.name }}
29+
ZIP_NAME: "${{ github.event.repository.name }}.zip"
30+
31+
jobs:
32+
build-zip:
33+
name: "Build a zip and upload to server"
34+
if: ${{ github.event.action != 'closed' && github.event.label.name == 'create zip' }}
35+
runs-on: ubuntu-latest
36+
outputs:
37+
branch_name: ${{ steps.get_current_branch.outputs.branch_name }}
38+
steps:
39+
- name: "Checkout"
40+
uses: actions/checkout@v4
41+
42+
- name: Use desired version of NodeJS
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: '20'
46+
cache: 'npm'
47+
48+
- name: Extract current branch name
49+
id: get_current_branch
50+
run: echo "branch_name=$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_OUTPUT
51+
52+
- name: Install dependencies
53+
run: npm ci
54+
55+
- name: Create a build
56+
run: npm run build
57+
58+
- name: Build a package
59+
run: bash ./bin/build-zip.sh
60+
61+
- name: Create branch directory
62+
run: |
63+
cd artifact
64+
mkdir -p ${{ steps.get_current_branch.outputs.branch_name }}
65+
mv ${{ env.ZIP_NAME }} ${{ steps.get_current_branch.outputs.branch_name }}/
66+
67+
- name: Upload a zip to server
68+
uses: burnett01/rsync-deployments@4.1
69+
with:
70+
# switches: -avzr --delete --delete-excluded --exclude-from=".distignore" --include="" --filter=""
71+
switches: -avzr
72+
path: ./artifact/
73+
remote_path: ${{ secrets.SSH_ZIP_PATH }}
74+
remote_host: ${{ secrets.SSH_HOST }}
75+
remote_port: ${{ secrets.SSH_PORT }}
76+
remote_user: ${{ secrets.SSH_USER }}
77+
remote_key: ${{ secrets.SSH_KEY }}
78+
79+
comment-on-pr:
80+
name: Comment on PR with links to plugin ZIPs
81+
if: ${{ github.event.action != 'closed' && github.head_ref && github.head_ref != null && github.event.label.name == 'create zip' }}
82+
runs-on: ubuntu-latest
83+
needs: build-zip
84+
env:
85+
CI: true
86+
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
87+
outputs:
88+
pr_number: ${{ steps.get_pr_number.outputs.pr_number }}
89+
comment_body: ${{ steps.get_comment_body.outputs.body }}
90+
steps:
91+
- name: Get PR number
92+
id: get_pr_number
93+
run: echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
94+
95+
- name: Get comment body
96+
id: get_comment_body
97+
run: |
98+
body="Plugin zip for ${{ github.event.pull_request.head.sha }} is ready :bellhop_bell:!
99+
- Download the plugin [zip](${{ env.ZIP_URL }}${{ needs.build-zip.outputs.branch_name }}/${{ env.ZIP_NAME }})"
100+
body="${body//$'\n'/'%0A'}"
101+
echo "body=$body" >> $GITHUB_OUTPUT
102+
103+
- name: Find an old comment if any
104+
uses: sandeshjangam/comment-actions@v1
105+
id: find_comment
106+
with:
107+
type: find
108+
number: ${{ steps.get_pr_number.outputs.pr_number }}
109+
search_term: Download the plugin [zip]
110+
111+
- name: Delete an old comment
112+
if: ${{ steps.find_comment.outputs.comment_id != '' }}
113+
uses: sandeshjangam/comment-actions@v1
114+
with:
115+
type: delete
116+
comment_id: ${{ steps.find_comment.outputs.comment_id }}
117+
118+
- name: Create a new comment with a download link of plugin zip
119+
uses: sandeshjangam/comment-actions@v1
120+
with:
121+
type: create
122+
number: ${{ steps.get_pr_number.outputs.pr_number }}
123+
body: ${{ steps.get_comment_body.outputs.body }}
124+
reactions: hooray, heart, rocket
125+
126+
clean-zip:
127+
name: "Clean a zip on server"
128+
if: ${{ github.event.action == 'closed' }}
129+
runs-on: ubuntu-latest
130+
steps:
131+
- name: "Checkout"
132+
uses: actions/checkout@v4
133+
134+
- name: Extract current branch name
135+
id: get_current_branch
136+
run: |
137+
echo "branch_name=$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_OUTPUT
138+
echo ${{ steps.get_current_branch.outputs.branch_name }}
139+
140+
- name: Execute a delete command using password
141+
if: ${{ steps.get_current_branch.outputs.branch_name != '' }}
142+
uses: appleboy/ssh-action@v1.0.3
143+
with:
144+
host: ${{ secrets.SSH_HOST }}
145+
port: ${{ secrets.SSH_PORT }}
146+
username: ${{ secrets.SSH_USER }}
147+
key: ${{ secrets.SSH_KEY }}
148+
script: |
149+
cd ${{ secrets.SSH_ZIP_PATH }}
150+
rm -rf ${{ steps.get_current_branch.outputs.branch_name }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build and Deploy
2+
3+
# Run the deployment only when code is committed to teh branch.
4+
on:
5+
push:
6+
branches:
7+
- development
8+
9+
env:
10+
PLUGIN_PATH: ${{ secrets.SSH_RC_PATH }}/wp-content/plugins/${{ github.event.repository.name }}/
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Use Node.js 20
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install Dependencies & Build
25+
run: npm ci && npm run build
26+
27+
- name: Build a package
28+
run: bash ./bin/build-zip.sh
29+
30+
- name: Set environment name
31+
run: |
32+
if [ '${{github.ref}}' = 'refs/heads/development' ]
33+
then
34+
echo "ENVIRONMENT=DEVELOPMENT" >> $GITHUB_ENV
35+
fi
36+
if [ '${{github.ref}}' = 'refs/heads/next-release' ]
37+
then
38+
echo "ENVIRONMENT=RELEASE_CANDIDATE" >> $GITHUB_ENV
39+
fi
40+
41+
- name: Rsync Deployment
42+
uses: burnett01/rsync-deployments@4.1
43+
with:
44+
# switches: -avzr --delete
45+
switches: -avzr
46+
path: artifact/ultimate-addons-for-gutenberg/
47+
remote_path: ${{ secrets[format('SSH_PATH_{0}', env.ENVIRONMENT)] }}
48+
remote_host: ${{ secrets.SSH_HOST }}
49+
remote_user: ${{ secrets.SSH_USER }}
50+
remote_key: ${{ secrets.SSH_KEY }}
51+
52+
- name: Rsync Drive Deployment
53+
uses: burnett01/rsync-deployments@4.1
54+
if: env.ENVIRONMENT == 'RELEASE_CANDIDATE'
55+
with:
56+
# switches: -avzr --delete
57+
switches: -avzr
58+
path: artifact/ultimate-addons-for-gutenberg/
59+
remote_path: ${{ secrets.SSH_DRIVE_PATH }}
60+
remote_host: ${{ secrets.SSH_DRIVE_HOST }}
61+
remote_user: ${{ secrets.SSH_DRIVE_USER }}
62+
remote_key: ${{ secrets.SSH_DRIVE_KEY }}
63+
64+
- name: Cleanup
65+
run: rm -rf artifact

0 commit comments

Comments
 (0)