Skip to content

_data json files explanation #7

_data json files explanation

_data json files explanation #7

Workflow file for this run

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