Skip to content

Update GitHub Actions deploy workflow for Astro build #36

@narendranathe

Description

@narendranathe

Update GitHub Actions deploy workflow for Astro build

Parent PRD: #34
User Story: As Naren, I want GitHub Pages to auto-deploy the Astro-built site on every push to main.
Type: Feature Slice
Complexity: S

Blocked by

Blocks

  • All issues that need end-to-end deploy verification depend on this being correct.

Context

Current .github/workflows/deploy.yml uploads the repo root (path: '.') directly to Pages - no build step. After Astro migration, we need to run npm install && npm run build first, then deploy the dist/ output folder. This is a small but critical change - getting it wrong means the site deploys broken HTML instead of built Astro output.

This issue can be created and merged ahead of the Astro scaffold (it will just fail until the Astro package.json exists, which is fine on a feature branch).

Acceptance Criteria

  • deploy.yml has Node.js 20 setup step using actions/setup-node@v4
  • npm ci runs before build (uses lockfile for reproducibility)
  • npm run build runs and outputs to dist/
  • actions/upload-pages-artifact path changed from '.' to './dist'
  • Workflow still triggers on push to main only
  • Permissions unchanged (pages: write, id-token: write)
  • PUBLIC_POSTHOG_KEY added as GitHub Actions secret (documented in README, not hardcoded)

Technical Notes

  • Modify: .github/workflows/deploy.yml
  • Insert between actions/checkout@v4 and actions/configure-pages@v4:
    - uses: actions/setup-node@v4
      with:
        node-version: 20
        cache: npm
    - run: npm ci
    - run: npm run build
      env:
        PUBLIC_POSTHOG_KEY: ${{ secrets.PUBLIC_POSTHOG_KEY }}
  • Change upload path: path: './dist'
  • Add to GitHub repo secrets: PUBLIC_POSTHOG_KEY (value from PostHog project settings)

Test Plan

Risks

  • npm ci requires package-lock.json to exist - must be committed alongside package.json when Astro is scaffolded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions