-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp of repo with several improvements (#132)
* typescripted and reorganized code * Error handling * Better error handling and constants organization * removed .cursor folder * Contributors and Creation Modification time of examples * Update contributors.json * GitHub Action update contributors * job name github-contributors * Fixed identation issue * Update contributors * update dates GitHub Action * Update creation and modification dates * remove contributors.json * updated descriptions of examples * updated fetch contributors to allow manually added ones * Added description of tags * Update contributors * Tabs for indentation in final examples.json * Update contributors * prettier rules for json * plugin sidebar enhanced README * contributors: username and full name * JSON prettier * fetch contributors good version * Contributor details * fixes examples.json slugs * New App with new Stack and UI * Update creation and modification dates * updated table format * update tables single and all * README.md for _bin and workflows folder + removed unnecesary scripts in package.json + general .cursorrules * Update contributors * Fixed linter errors and other minor fixes * test writeToPath blueprint * release zips github action * proper scripts to generate zips * install pnpm on gh action * Fixed GITHUB_TOKEN issue * Fix GitHub Authentication issue for GH Action * fix upload zips to release * fix error zips * latest release tag for zips * Stylelint config fixed * Updated main github actions * filename codes syntax for GitHub Actions * GitHub Actions Highlights * GitHub Actions fine tuning * Added emoijs * Fine Tune GitHub Actions + Updated constants + updated blueprint * build folder translations examples * blueprints: ref HEAD for git-directory on installPlugin step * Updated examples with build folders and reviewed and updated blueprints * README.md of examples updated * Main app link on README * fork links * README.md updated * Reviewed README.md of all examples * Checked h1 for example titles in READMEs * Updated main table * WIKI links on main README * removed CHANGELOGs and updated README github workflows * Update references to "WordPress" * README updated --------- Co-authored-by: GitHub Action <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
387c51b
commit f0b9107
Showing
316 changed files
with
6,227 additions
and
2,599 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# GitHub Workflows | ||
|
||
This directory contains GitHub Actions workflows that automate various tasks in the repository. Below is an overview of each workflow: | ||
|
||
## Main Workflows | ||
|
||
### 🚀 Generate Examples Zips and Create Release (`release-zips.yml`) | ||
|
||
Handles the creation and deployment of plugin zip packages: | ||
|
||
- Generates zip files for all examples | ||
- Creates versioned releases with date-based tags | ||
- Maintains a "latest" release that's always up to date | ||
- Can be triggered manually or on push to trunk branch | ||
- Uses pnpm for dependency management | ||
- Runs on Node.js environment | ||
|
||
### 🔍 Static Linting (`static-linting.yml`) | ||
|
||
Performs comprehensive code quality checks: | ||
|
||
- PHP file linting using Composer | ||
- JavaScript file linting | ||
- CSS file linting | ||
- Runs on Node.js 18 and latest LTS versions | ||
- Uses pnpm for package management | ||
- Triggered on pull requests and trunk branch pushes | ||
|
||
## Data Management Workflows | ||
|
||
### 👥 GitHub Contributors Management | ||
|
||
#### Update Contributors List (`github-contributors.yml`) | ||
|
||
- Updates basic contributor information | ||
- Maintains contributor records | ||
- Can be manually triggered | ||
|
||
#### Contributor Details (`contributor-details.yml`) | ||
|
||
- Fetches and updates detailed contributor information | ||
- Updates contributor metadata | ||
- Supports manual triggering | ||
|
||
### 📅 Date Management (`update-dates.yml`) | ||
|
||
- Maintains creation and modification dates | ||
- Updates example metadata | ||
- Runs on a schedule and supports manual triggers | ||
|
||
## Scripts Directory | ||
|
||
The `scripts/` directory contains supporting shell scripts used by these workflows. | ||
|
||
## Workflow Permissions | ||
|
||
Workflows require appropriate GitHub permissions for: | ||
|
||
- Creating and updating releases | ||
- Pushing to branches | ||
- Managing workflow artifacts | ||
- Updating repository data | ||
|
||
## Trigger Methods | ||
|
||
- Push to trunk branch | ||
- Pull request events | ||
- Manual triggers via workflow_dispatch | ||
- Scheduled runs (for specific workflows) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: _Contributor Details | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-contributor-details: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Make script executable | ||
run: chmod +x .github/workflows/scripts/fetch_contributor_details.sh | ||
|
||
- name: Fetch contributor details | ||
run: .github/workflows/scripts/fetch_contributor_details.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Commit changes | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add _data/contributors.json | ||
git diff --quiet && git diff --staged --quiet || git commit -m "Update contributor details" | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: _Update GitHub Contributors | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
github-contributors: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # Needed to push changes | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Make script executable | ||
run: chmod +x .github/workflows/scripts/fetch_contributors.sh | ||
|
||
- name: Update contributors | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REPO_OWNER: ${{ github.repository_owner }} | ||
REPO_NAME: ${{ github.event.repository.name }} | ||
run: ./.github/workflows/scripts/fetch_contributors.sh | ||
|
||
- name: Commit changes | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git add _data/examples.json | ||
git diff --quiet && git diff --staged --quiet || git commit -m "Update contributors" | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: "🚀 Generate Examples Zips and Create Release" | ||
|
||
on: | ||
push: | ||
branches: | ||
- trunk # Or your default branch | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
zip-packages: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Set up Node.js and install dependencies | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' # Use your preferred Node.js version | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
version: 8.7.1 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
# Create zips directory | ||
- name: Create zips directory | ||
run: mkdir -p zips | ||
|
||
# Run the plugin-zip script to generate zip files | ||
- name: Generate zip files | ||
run: | | ||
npm run deploy | ||
ls -la zips/ # Debug: List contents of zips directory | ||
# Install GitHub CLI | ||
- name: Install GitHub CLI | ||
run: sudo apt-get install -y gh | ||
|
||
# Authenticate with GitHub CLI | ||
- name: Authenticate GitHub CLI | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh auth setup-git -h github.com | ||
|
||
# Create GitHub Release | ||
- name: Create GitHub Release | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Create a dated tag for version tracking | ||
RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')" | ||
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV | ||
# Create the new release | ||
gh release create $RELEASE_TAG \ | ||
--title "Release $RELEASE_TAG" \ | ||
--notes "This release contains the latest package zips." | ||
# Upload the zips to the Release with consistent names | ||
- name: Upload Zips to Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
for file in zips/*.zip; do | ||
[ -e "$file" ] || continue | ||
# Extract the base name without path and extension | ||
filename=$(basename "$file") | ||
# Upload to the versioned release | ||
gh release upload "${{ env.RELEASE_TAG }}" "$file" | ||
done | ||
# Update or create the "latest" release tag | ||
- name: Update Latest Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Delete existing latest tag and release if they exist | ||
gh release delete latest --yes || true | ||
git push origin :latest || true | ||
# Create new latest release | ||
gh release create latest \ | ||
--title "Latest Release" \ | ||
--notes "This is always the latest release. For permanent links, use the dated releases." \ | ||
--latest | ||
# Upload files to latest release | ||
for file in zips/*.zip; do | ||
[ -e "$file" ] || continue | ||
gh release upload latest "$file" --clobber | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
echo "Starting contributor details fetch process..." | ||
|
||
# Configuration | ||
CONTRIBUTORS_FILE="_data/contributors.json" | ||
EXAMPLES_FILE="_data/examples.json" | ||
TOKEN="${GITHUB_TOKEN}" | ||
|
||
# Extract unique contributors from examples.json | ||
echo "Extracting unique contributors..." | ||
CONTRIBUTORS=$(cat "$EXAMPLES_FILE" | jq -r '[.[].contributors[]?] | unique | .[]') | ||
|
||
# Initialize empty array for results | ||
echo "[]" > "$CONTRIBUTORS_FILE" | ||
|
||
# Process each contributor | ||
echo "$CONTRIBUTORS" | while read -r username; do | ||
if [ -n "$username" ]; then | ||
echo "Fetching details for $username..." | ||
|
||
# Fetch user details from GitHub API | ||
user_data=$(curl -s -H "Authorization: token $TOKEN" \ | ||
"https://api.github.com/users/$username") | ||
|
||
# Extract full name (use username if name is null) | ||
name=$(echo "$user_data" | jq -r '.name // .login') | ||
|
||
# Add to contributors.json | ||
existing_content=$(cat "$CONTRIBUTORS_FILE") | ||
echo "$existing_content" | jq --arg username "$username" \ | ||
--arg name "$name" \ | ||
'. + [{"username": $username, "name": $name}]' > "$CONTRIBUTORS_FILE" | ||
|
||
# Respect GitHub API rate limits | ||
sleep 1 | ||
fi | ||
done | ||
|
||
echo "Finished fetching contributor details. Results saved to $CONTRIBUTORS_FILE ✅" |
Oops, something went wrong.