From 5979d4cc56fe588df1d955cc3d034c8f4a8fa05d Mon Sep 17 00:00:00 2001 From: abdallah-khalil Date: Tue, 20 Jan 2026 11:14:13 +0200 Subject: [PATCH] chore(ci): optimize workflow triggers - CI now only runs on pull requests (not on main push) - Disable deploy-gh-pages automatic trigger (manual only for now) - Update release-please workflow settings This prevents duplicate workflow runs when PRs are merged. --- .github/workflows/ci.yml | 3 - .github/workflows/deploy-gh-pages.yml | 22 ++- .github/workflows/release-please.yml | 250 +++++++++++++------------- 3 files changed, 138 insertions(+), 137 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 151639e..867c355 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,6 @@ name: CI on: - push: - branches: - - main pull_request: permissions: diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index d9e0a9a..54271e0 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -1,15 +1,19 @@ name: Deploy to GitHub Pages -# Task 2.1: Trigger using workflow_run to wait for CI completion -# Pattern: workflow_run event ensures deployment only runs after CI passes -# Research: Task 1.3 confirmed needs: [ci] doesn't work across workflow files +# TEMPORARILY DISABLED +# Uncomment the 'on' block below to re-enable +# +# on: +# workflow_run: +# workflows: ['CI'] +# types: +# - completed +# branches: +# - main + +# Disabled - manual trigger only for now on: - workflow_run: - workflows: ['CI'] # Must match name in .github/workflows/ci.yml - types: - - completed - branches: - - main + workflow_dispatch: # Top-level permissions for safety (deploy job has its own) # Pattern from: .github/workflows/ci.yml:9-11 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index bd75b57..5eaf032 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -1,125 +1,125 @@ -# RELEASE PLEASE WORKFLOW -# This workflow automates versioning and releases using Google's Release Please. -# -# How it works: -# 1. On every push to main, Release Please analyzes conventional commits -# 2. It creates/updates a "Release PR" with version bumps and CHANGELOG -# 3. When you merge the Release PR, it creates tags and GitHub releases -# 4. The publish workflow then publishes to npm -# -# Commit types and their effects: -# - feat: → minor version bump (1.0.0 → 1.1.0) -# - fix: → patch version bump (1.0.0 → 1.0.1) -# - feat!: or BREAKING CHANGE: → major version bump (1.0.0 → 2.0.0) -# - chore:, docs:, style:, refactor:, test: → no version bump -# -# For monorepo packages, use scopes: -# - feat(angular-3d): new feature → bumps @hive-academy/angular-3d -# - fix(angular-gsap): bug fix → bumps @hive-academy/angular-gsap - -name: Release Please - -on: - push: - branches: - - main - workflow_dispatch: # Allow manual trigger - -permissions: - contents: write - pull-requests: write - -jobs: - release-please: - runs-on: ubuntu-latest - outputs: - angular-3d--release_created: ${{ steps.release.outputs['libs/angular-3d--release_created'] }} - angular-3d--tag_name: ${{ steps.release.outputs['libs/angular-3d--tag_name'] }} - angular-3d--version: ${{ steps.release.outputs['libs/angular-3d--version'] }} - angular-gsap--release_created: ${{ steps.release.outputs['libs/angular-gsap--release_created'] }} - angular-gsap--tag_name: ${{ steps.release.outputs['libs/angular-gsap--tag_name'] }} - angular-gsap--version: ${{ steps.release.outputs['libs/angular-gsap--version'] }} - steps: - - name: Run Release Please - id: release - uses: googleapis/release-please-action@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - config-file: release-please-config.json - manifest-file: .release-please-manifest.json - - # Publish @hive-academy/angular-3d when released - publish-angular-3d: - needs: release-please - if: needs.release-please.outputs.angular-3d--release_created == 'true' - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write # For npm provenance - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm ci - - - name: Build - run: npx nx build angular-3d - - - name: Publish to npm - run: | - cd dist/libs/angular-3d - npm publish --access public --provenance - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Summary - run: | - echo "## 🚀 Published @hive-academy/angular-3d@${{ needs.release-please.outputs.angular-3d--version }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "**Tag:** ${{ needs.release-please.outputs.angular-3d--tag_name }}" >> $GITHUB_STEP_SUMMARY - - # Publish @hive-academy/angular-gsap when released - publish-angular-gsap: - needs: release-please - if: needs.release-please.outputs.angular-gsap--release_created == 'true' - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write # For npm provenance - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: npm ci - - - name: Build - run: npx nx build angular-gsap - - - name: Publish to npm - run: | - cd dist/libs/angular-gsap - npm publish --access public --provenance - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Summary - run: | - echo "## 🚀 Published @hive-academy/angular-gsap@${{ needs.release-please.outputs.angular-gsap--version }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "**Tag:** ${{ needs.release-please.outputs.angular-gsap--tag_name }}" >> $GITHUB_STEP_SUMMARY +# RELEASE PLEASE WORKFLOW +# This workflow automates versioning and releases using Google's Release Please. +# +# How it works: +# 1. On every push to main, Release Please analyzes conventional commits +# 2. It creates/updates a "Release PR" with version bumps and CHANGELOG +# 3. When you merge the Release PR, it creates tags and GitHub releases +# 4. The publish workflow then publishes to npm +# +# Commit types and their effects: +# - feat: → minor version bump (1.0.0 → 1.1.0) +# - fix: → patch version bump (1.0.0 → 1.0.1) +# - feat!: or BREAKING CHANGE: → major version bump (1.0.0 → 2.0.0) +# - chore:, docs:, style:, refactor:, test: → no version bump +# +# For monorepo packages, use scopes: +# - feat(angular-3d): new feature → bumps @hive-academy/angular-3d +# - fix(angular-gsap): bug fix → bumps @hive-academy/angular-gsap + +name: Release Please + +on: + push: + branches: + - main + workflow_dispatch: # Allow manual trigger + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + angular-3d--release_created: ${{ steps.release.outputs['libs/angular-3d--release_created'] }} + angular-3d--tag_name: ${{ steps.release.outputs['libs/angular-3d--tag_name'] }} + angular-3d--version: ${{ steps.release.outputs['libs/angular-3d--version'] }} + angular-gsap--release_created: ${{ steps.release.outputs['libs/angular-gsap--release_created'] }} + angular-gsap--tag_name: ${{ steps.release.outputs['libs/angular-gsap--tag_name'] }} + angular-gsap--version: ${{ steps.release.outputs['libs/angular-gsap--version'] }} + steps: + - name: Run Release Please + id: release + uses: googleapis/release-please-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + # Publish @hive-academy/angular-3d when released + publish-angular-3d: + needs: release-please + if: needs.release-please.outputs.angular-3d--release_created == 'true' + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # For npm provenance + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npx nx build angular-3d + + - name: Publish to npm + run: | + cd dist/libs/angular-3d + npm publish --access public --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Summary + run: | + echo "## 🚀 Published @hive-academy/angular-3d@${{ needs.release-please.outputs.angular-3d--version }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Tag:** ${{ needs.release-please.outputs.angular-3d--tag_name }}" >> $GITHUB_STEP_SUMMARY + + # Publish @hive-academy/angular-gsap when released + publish-angular-gsap: + needs: release-please + if: needs.release-please.outputs.angular-gsap--release_created == 'true' + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # For npm provenance + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npx nx build angular-gsap + + - name: Publish to npm + run: | + cd dist/libs/angular-gsap + npm publish --access public --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Summary + run: | + echo "## 🚀 Published @hive-academy/angular-gsap@${{ needs.release-please.outputs.angular-gsap--version }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "**Tag:** ${{ needs.release-please.outputs.angular-gsap--tag_name }}" >> $GITHUB_STEP_SUMMARY