ci: deploy to github pages #5 #49
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: | ||
# Trigger the workflow every time you push to the `main` branch | ||
# Using a different branch name? Replace `main` with your branch’s name | ||
push: | ||
branches: [ main ] | ||
# Allows you to run this workflow manually from the Actions tab on GitHub. | ||
workflow_dispatch: | ||
# Allow this job to clone the repo and create a page deployment | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Checkout your repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# Step 2: Set up Node.js version 20.3.0 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20.3.0' | ||
# Step 3: Install dependencies | ||
- name: Install dependencies | ||
run: npm install | ||
# Step 3: Set up Deno | ||
- name: Set up Deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.5.1 | ||
# Step 4: Build the Astro site | ||
- name: Build Astro site | ||
run: npm run astro build | ||
# Step 5: Upload the build artifacts | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: github-pages | ||
path: ./dist # Ensure this is the correct path to your build output | ||
deploy: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
# Step 1: Download the artifacts | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: github-pages | ||
# Step 2: Deploy to GitHub Pages | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
uses: actions/deploy-pages@v4 | ||