diff --git a/.github/workflows/build-prs-to-main.yml b/.github/workflows/build-prs-to-main.yml deleted file mode 100644 index a682fb136..000000000 --- a/.github/workflows/build-prs-to-main.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build code - -on: - workflow_dispatch: - pull_request: - branches: - - main - -permissions: - contents: read - -jobs: - pr-build: - runs-on: ubuntu-22.04 - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Run linting and formatting - run: | - npm run lint - npm run prettier - - - name: Build site - run: npm run build diff --git a/.github/workflows/deploy-page.yml b/.github/workflows/ci-cd.yml similarity index 59% rename from .github/workflows/deploy-page.yml rename to .github/workflows/ci-cd.yml index 15ee12c1a..bcda19a0d 100644 --- a/.github/workflows/deploy-page.yml +++ b/.github/workflows/ci-cd.yml @@ -1,13 +1,17 @@ -name: Build and deploy to GitHub Pages +name: Build and Deploy on: workflow_dispatch: + pull_request: push: branches: - main +permissions: + contents: write + jobs: - github-pages: + build-and-deploy: runs-on: ubuntu-22.04 environment: name: github-pages @@ -33,8 +37,21 @@ jobs: - name: Build site run: npm run build + - name: Check build output + run: | + if [ ! -d "_site" ]; then + echo "Error: _site directory not found" + exit 1 + fi + if [ ! -f "_site/index.html" ]; then + echo "Error: index.html not found in _site" + exit 1 + fi + echo "✅ Build validation successful" + - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./_site