Skip to content

Commit

Permalink
Serve dist to Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
gigincg committed Dec 5, 2024
1 parent 8f4bf45 commit bc7e4a9
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 26 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy to GitHub Pages

on:
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: "package-lock.json"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "dist"

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
35 changes: 9 additions & 26 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ on:
- micro_refactor
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -21,31 +16,19 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
node-version: "18"
cache: "npm"
cache-dependency-path: "package-lock.json"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'dist'

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
keep_files: true

0 comments on commit bc7e4a9

Please sign in to comment.