Skip to content

Commit

Permalink
Add GitHub action for deploying to GitHub pages
Browse files Browse the repository at this point in the history
  • Loading branch information
porst17 committed Jun 3, 2024
1 parent dc762a6 commit e64e082
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Deploy to GitHub Pages

on:
# Run on tag pushes matching starting with 'v'
push:
tags:
- 'v*'

# ... Also run manually
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: write
pull-requests: read
env:
INPUT_PATH: "."
steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '20.9.x'

- name: Install dependencies
run: npm clean-install

- name: Build
run: npm run build

- name: Fix permissions
run: |
chmod -c -R +rX "$INPUT_PATH" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Archive artifact
shell: sh
run: |
echo ::group::Archive artifact
tar \
--dereference --hard-dereference \
--directory "$INPUT_PATH" \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
--exclude=*/node_modules/* \
--exclude=node_modules/* \
$(test -f ../.releaseignore && echo "--exclude-from=../.releaseignore") \
.
echo ::endgroup::
- name: Upload artifact
id: upload-artifact
uses: actions/[email protected]
with:
name: github-pages
path: ${{ runner.temp }}/artifact.tar
retention-days: 1
if-no-files-found: error

deploy:
needs: build
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected]

0 comments on commit e64e082

Please sign in to comment.