Clean and improve workflows #17
This file contains hidden or 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
| name: Build package versions | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: build-zips-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| VERSION_V0: "0.0.3" | |
| VERSION_V1: "1.0.2" | |
| VERSION_V2: "2.0.1" | |
| jobs: | |
| build: | |
| name: 📦 Build package versions | |
| runs-on: ubuntu-latest | |
| if: github.actor != 'github-actions[bot]' | |
| steps: | |
| - name: ⬇️ Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: 🔧 Make package script executable | |
| run: chmod +x .github/scripts/packages.sh | |
| - name: 🧩 Create versioned copies | |
| shell: bash | |
| run: .github/scripts/packages.sh create-versioned-copies | |
| - name: 📦 Build main package ZIPs | |
| shell: bash | |
| run: .github/scripts/packages.sh build-main-zips | |
| - name: 🗂️ Build version ZIPs | |
| shell: bash | |
| run: .github/scripts/packages.sh build-version-zips | |
| - name: ✅ Commit & push changes (if any) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| # Show status for debugging (doesn't affect logic) | |
| git status --porcelain | |
| if git status --porcelain | grep .; then | |
| echo "Changes detected, committing..." | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .versions/ */*.zip */module.json */system.json 2>/dev/null || true | |
| if git diff --cached --quiet; then | |
| echo "No relevant changes to commit after add." | |
| exit 0 | |
| fi | |
| git commit -m "chore: Update packages and versioned copies (automated)" | |
| # Try to rebase onto latest main to avoid push failures | |
| git pull --rebase origin "$GITHUB_REF_NAME" || true | |
| git push | |
| else | |
| echo "No changes to commit." | |
| fi |