Skip to content

ci: Deploy to Github pages. #1

ci: Deploy to Github pages.

ci: Deploy to Github pages. #1

Workflow file for this run

name: Deploy to GitHub Pages
on:
# Run on pushes to the default branch
push:
branches:
- main
# ... 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