Skip to content

Commit

Permalink
fix: github action deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
caidanw committed Feb 25, 2024
1 parent 206d12a commit 2d7c40c
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/deploy_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Deploy Svelte static site to GitHub Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
branches: "master"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -23,45 +23,47 @@ concurrency:

jobs:
# Single deploy job since we're just deploying
build:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Configure GitHub Pages
uses: actions/[email protected]
with:
# Optional static site generator to attempt to configure: "nuxt", "next", "gatsby", or "sveltekit"
static_site_generator: sveltekit
- name: Setup Node
uses: actions/setup-node@v3
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
node-version: 20
cache: npm

- name: Install and Build
env:
BASE_PATH: '/${{ github.event.repository.name }}'
run: |
npm ci
npm run build
- name: Upload GitHub Pages artifact
uses: actions/[email protected]
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
# Artifact name
name: github-pages
# Path of the directory containing the static assets.
path: ./build
path: build/
# Duration after which artifact will expire in days.
retention-days: 1

deploy:
needs: build_site
runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1.2.5
uses: actions/deploy-pages@v4
with:
# Name of the artifact to deploy
artifact_name: github-pages

0 comments on commit 2d7c40c

Please sign in to comment.