Reboot Project #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, Test & Deploy | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build Site | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout your repository using git | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2 | |
with: | |
bun-version-file: .bun-version | |
- name: Install dependencies | |
run: bun install --frozen-lockfile | |
- name: Build your site | |
run: bun run build | |
- name: Upload Pages Artifact | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4 | |
with: | |
name: build-files | |
path: '.vercel/output' | |
include-hidden-files: true | |
retention-days: 1 | |
test: | |
name: Lighthouse CI Test | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Get configuration files | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
sparse-checkout: | | |
wrangler.toml | |
sparse-checkout-cone-mode: false | |
- name: Setup Node | |
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4 | |
- name: Install necessary tools | |
run: npm install --global wrangler @unlighthouse/cli puppeteer | |
- name: Get Built Site | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 | |
with: | |
name: build-files | |
path: '.vercel/output' | |
- name: Test with Lighthouse | |
env: | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
run: | | |
npx wrangler pages dev & | |
npx unlighthouse-ci --site http://localhost:8788 --build-static --router-prefix __lighthouse | |
continue-on-error: true | |
- name: Upload Lighthouse Result | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4 | |
with: | |
name: lighthouse-result | |
path: '.unlighthouse' | |
include-hidden-files: true | |
retention-days: 1 | |
deploy: | |
name: Deploy to Cloudflare Pages | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Get configuration files | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
sparse-checkout: | | |
wrangler.toml | |
sparse-checkout-cone-mode: false | |
- name: Get Built Site | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 | |
with: | |
name: build-files | |
path: '.vercel/output' | |
- name: Get Lighthouse results | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 | |
with: | |
name: lighthouse-result | |
path: .vercel/output/static/__lighthouse | |
- name: Deploy to Cloudflare Pages | |
uses: cloudflare/wrangler-action@f84a562284fc78278ff9052435d9526f9c718361 # v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy .vercel/output/static --project-name=dailymahfudzat |