Skip to content

Increment cache busting to v4 #79

Increment cache busting to v4

Increment cache busting to v4 #79

name: Deploy to GitHub Pages
on:
push:
branches: ["main", "demo"]
tags: ["v*"]
workflow_dispatch:
inputs:
version_tag:
description: "Tag to deploy to versioned subfolder (e.g. v1)"
required: false
permissions:
contents: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.version_tag || github.ref }}
- name: Write version info
run: |
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "untagged")
echo "{\"tag\":\"$TAG\",\"branch\":\"${{ github.ref_name }}\",\"sha\":\"${{ github.sha }}\"}" > version.json
- name: Deploy to gh-pages (root)
if: ${{ github.ref == 'refs/heads/main' && !inputs.version_tag }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: .
target-folder: /
clean-exclude: |
pr-*
v*
demo
- name: Deploy demo branch to /demo subfolder
if: github.ref == 'refs/heads/demo'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: .
target-folder: demo
clean: false
- name: Deploy to versioned subfolder (tags only)
if: startsWith(github.ref, 'refs/tags/') || inputs.version_tag
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: .
target-folder: ${{ inputs.version_tag || github.ref_name }}
clean: false