Skip to content

Commit

Permalink
ci: Add Github Actions workflow for GitHub Pages deployment.
Browse files Browse the repository at this point in the history
Squashed commits:
[3cbace4] ci: Fix action hash.
[1de38e2] ci: Add Github Actions workflow for GitHub Pages deployment.
  • Loading branch information
elondaits committed Apr 6, 2024
1 parent 58c9fd3 commit d8b6bc9
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Deploy to GitHub Pages

on:
# Run on pushes to the default branch
push:
branches:
[$default-branch]

# ... 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: "dist/"
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
node-version: '18.19.x'

- name: Install dependencies
run: npm 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::
env:
INPUT_PATH: ${{ env.INPUT_PATH }}

- name: Upload artifact
id: upload-artifact
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
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/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e

0 comments on commit d8b6bc9

Please sign in to comment.