diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index f731084..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - test_and_build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Bun - uses: oven-sh/setup-bun@v1 - - - name: Install dependencies - run: bun install - - - name: Run svelte-check - run: bun run check - - - name: Run lint - run: bun run lint - - - name: Run tests - run: bun run test - - - name: Build - run: bun run build diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index daa002d..dde9afc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,21 +1,39 @@ -name: Deploy to GitHub Pages +name: Unified CI/CD Pipeline on: push: - branches: 'main' + branches: + - main + pull_request: + branches: + - main + +permissions: + contents: read jobs: - build_site: + type-check: + name: Type Check runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - # If you're using pnpm, add this step then change the commands and cache key below to use `pnpm` - # - name: Install pnpm - # uses: pnpm/action-setup@v3 - # with: - # version: 8 + - name: Install Bun + uses: oven-sh/setup-bun@v1 + + - name: Install dependencies + run: bun install + + - name: Run svelte-check + run: bun run check + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 - name: Install Bun uses: oven-sh/setup-bun@v1 @@ -23,31 +41,60 @@ jobs: - name: Install dependencies run: bun install - - name: build - env: - BASE_PATH: '/${{ github.event.repository.name }}' - run: | - bun run build + - name: Run lint + run: bun run lint - - name: Upload Artifacts - uses: actions/upload-pages-artifact@v3 - with: - # this should match the `pages` option in your adapter-static options - path: 'build/' + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Bun + uses: oven-sh/setup-bun@v1 + + - name: Install dependencies + run: bun install + + - name: Run tests + run: bun run test deploy: - needs: build_site + name: Deploy + needs: [type-check, lint, test] + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest permissions: pages: write id-token: write + contents: read environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - - name: Deploy + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Bun + uses: oven-sh/setup-bun@v1 + + - name: Install dependencies + run: bun install + + - name: Build site + env: + BASE_PATH: '/${{ github.event.repository.name }}' + run: bun run build + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'build/' + + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4