Skip to content

Commit

Permalink
Simplify build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuvonen committed Dec 27, 2023
1 parent cc42acc commit 5898512
Showing 1 changed file with 38 additions and 28 deletions.
66 changes: 38 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
name: Publish to pages
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.10
- name: Install dependencies
run: npm ci
- run: npm run build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dist/'
deploy:
needs: build
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

# Deploy to the github-pages environment
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 20.10
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
uses: actions/deploy-pages@v2

0 comments on commit 5898512

Please sign in to comment.