From 71af08cb4cd0238a7c6b5b54fd6127404d2fb9e8 Mon Sep 17 00:00:00 2001 From: Manideep SP Date: Sat, 17 Jan 2026 17:34:01 +0530 Subject: [PATCH] chore(ci): remove duplicate publish_to_gh_pages.yml workflow Keeping deploy-main.yml which is consistent with deploy-dev.yml and deploy-qa.yml. The .nojekyll fix makes the asset renaming workaround in publish_to_gh_pages.yml unnecessary. --- .github/workflows/publish_to_gh_pages.yml | 105 ---------------------- 1 file changed, 105 deletions(-) delete mode 100644 .github/workflows/publish_to_gh_pages.yml diff --git a/.github/workflows/publish_to_gh_pages.yml b/.github/workflows/publish_to_gh_pages.yml deleted file mode 100644 index 170a1c8f..00000000 --- a/.github/workflows/publish_to_gh_pages.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Build and publish to gh-pages - -on: - push: - branches: [ main ] - -permissions: - contents: write - -jobs: - build-and-publish: - runs-on: ubuntu-latest - concurrency: - group: publish-gh-pages - cancel-in-progress: true - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - - - name: Install dependencies - run: npm ci --no-audit --no-fund - - - name: Build - run: npm run build - - - name: Prepare and publish to gh-pages - env: - REPO: ${{ github.repository }} - TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMMIT_MSG: "chore(publish): build from main ${{ github.sha }}" - run: | - set -e - # Move into the build output - cd dist - - # Ensure GitHub Pages does not run Jekyll - touch .nojekyll - - # Normalize asset paths: rename `_astro` to `assets` and update HTML references - if [ -d "_astro" ]; then - # Rename the directory (not move into) - mv _astro assets - echo "Renamed _astro -> assets" - ls -la assets | head -10 - # Update references in html files to point to /assets/ instead of /_astro/ - # Also handle repo-base prefixed references like /Portfolio-ManideepSP/_astro/ - find . -type f -name '*.html' -print0 | xargs -0 sed -i 's|/Portfolio-ManideepSP/_astro/|/Portfolio-ManideepSP/assets/|g' - find . -type f -name '*.html' -print0 | xargs -0 sed -i 's|/_astro/|/assets/|g' - echo "Updated HTML references" - else - echo "WARNING: _astro directory not found in dist" - fi - - # Ensure assets exist after normalization — fail early if not present. - if [ -d "assets" ]; then - echo "assets directory present" - else - echo "ERROR: assets directory missing; aborting publish." >&2 - echo "---- dist listing for debugging ----" >&2 - ls -la || true - exit 1 - fi - - # Initialize a fresh git repo and commit the build output - git init - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - - # If there are no changes, exit early - if git diff --staged --quiet; then - echo "No changes to publish" - exit 0 - fi - - git commit -m "$COMMIT_MSG" - - # Push to gh-pages branch. This updates gh-pages to the exact build output. - # We use --force-with-lease to avoid accidental clobbering when there is a concurrent update. - git remote add origin "https://x-access-token:${TOKEN}@github.com/${REPO}.git" - - # Try to fetch the remote gh-pages branch so --force-with-lease has a lease to work with. - # If the branch doesn't exist yet, fetch will exit non-zero; ignore errors. - git fetch origin gh-pages || true - - # First attempt a safe push. If the remote has changed since the workflow started, - # --force-with-lease will fail. In that case, fall back to a plain --force push - # because `gh-pages` is generated output and we intentionally overwrite it. - if git push --force-with-lease origin HEAD:gh-pages; then - echo "Pushed gh-pages with --force-with-lease" - else - echo "--force-with-lease failed, falling back to --force" - git push --force origin HEAD:gh-pages - fi - - - name: Done - run: echo "Published to gh-pages"