Update deploy.yml #21
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: Deploy to GitHub Pages | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout your repository using git | |
uses: actions/checkout@v4 | |
- name: Install, build, and upload your site | |
uses: withastro/action@v3 | |
with: | |
path: . # Set the path to the root of your Astro project | |
node-version: 20 # Specify Node.js version if needed | |
package-manager: bun # Set package manager to Bun if your project uses it | |
# Upload artifact for Lighthouse CI compatibility | |
- name: Upload build output for Lighthouse | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist-folder # Artifact name for Lighthouse CI | |
path: dist/** # Ensure all files in dist are included | |
lighthouse: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Download artifact for Lighthouse CI analysis | |
- name: Download build output artifact for Lighthouse | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist-folder | |
path: dist # Download into the 'dist' directory | |
- name: List files in current directory | |
run: ls -la | |
- name: List files in dist directory | |
run: ls -la dist | |
- name: Install Lighthouse CI globally | |
run: npx lhci autorun --collect.staticDistDir=dist --assert.assertions.errors-in-console=warn | |
deploy: | |
needs: [build, lighthouse] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |