Skip to content

Deploy to Pages on all branches #5

Deploy to Pages on all branches

Deploy to Pages on all branches #5

name: Publish GitHub Pages
on:
push:
# branches:
# - main
paths:
- .github/workflows/publish-github-pages.yaml
- samples/**
workflow_dispatch: {}
defaults:
run:
shell: bash
env:
node-version: 22
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checking out for ${{ github.ref }}
uses: actions/checkout@v4
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: npm
# - name: Run npm ci --no-production
# env:
# NODE_ENV: production
# run: |
# cd samples
# npm ci --no-production
# - name: Run npm run bootstrap
# run: |
# cd samples
# npm run bootstrap
- run: npm clean-install
working-directory: ./samples
- name: Run npm run build
env:
NODE_ENV: production
run: npm run build
working-directory: ./samples
- name: Copy files
run: |
mkdir gh-pages
rsync -av --progress samples/index.css gh-pages/
rsync -av --progress samples/index.html gh-pages/
rsync -av --progress samples/README.md gh-pages/
mkdir gh-pages/00.migration
rsync -av --progress samples/00.migration/ gh-pages/00.migration/
mkdir gh-pages/01.getting-started
rsync -av --progress samples/01.getting-started/ gh-pages/01.getting-started/ \
--exclude g.hybrid-react-npm
mkdir gh-pages/01.getting-started/g.hybrid-react-npm
rsync -av --progress samples/01.getting-started/g.hybrid-react-npm/packages/app/build/ gh-pages/01.getting-started/g.hybrid-react-npm/
mkdir gh-pages/02.branding-styling-and-customization
rsync -av --progress samples/02.branding-styling-and-customization/ gh-pages/02.branding-styling-and-customization/
mkdir gh-pages/03.speech
rsync -av --progress samples/03.speech/ gh-pages/03.speech/
mkdir gh-pages/04.api
rsync -av --progress samples/04.api/ gh-pages/04.api/ \
--exclude e.piping-to-redux \
--exclude f.selectable-activity \
--exclude g.chat-send-history \
--exclude h.clear-after-idle
mkdir gh-pages/04.api/e.piping-to-redux
rsync -av --progress samples/04.api/e.piping-to-redux/build/ gh-pages/04.api/e.piping-to-redux/
mkdir gh-pages/04.api/f.selectable-activity
rsync -av --progress samples/04.api/f.selectable-activity/build/ gh-pages/04.api/f.selectable-activity/
mkdir gh-pages/04.api/g.chat-send-history
rsync -av --progress samples/04.api/g.chat-send-history/build/ gh-pages/04.api/g.chat-send-history/
mkdir gh-pages/04.api/h.clear-after-idle
rsync -av --progress samples/04.api/h.clear-after-idle/build/ gh-pages/04.api/h.clear-after-idle/
mkdir gh-pages/05.custom-components
rsync -av --progress samples/05.custom-components/ gh-pages/05.custom-components/
mkdir gh-pages/06.recomposing-ui
rsync -av --progress samples/06.recomposing-ui/ gh-pages/06.recomposing-ui/ \
--exclude a.minimizable-web-chat \
--exclude b.speech-ui \
--exclude c.smart-display \
--exclude d.plain-ui
mkdir gh-pages/06.recomposing-ui/a.minimizable-web-chat
rsync -av --progress samples/06.recomposing-ui/a.minimizable-web-chat/build/ gh-pages/06.recomposing-ui/a.minimizable-web-chat/
mkdir gh-pages/06.recomposing-ui/b.speech-ui
rsync -av --progress samples/06.recomposing-ui/b.speech-ui/build/ gh-pages/06.recomposing-ui/b.speech-ui/
mkdir gh-pages/06.recomposing-ui/c.smart-display
rsync -av --progress samples/06.recomposing-ui/c.smart-display/build/ gh-pages/06.recomposing-ui/c.smart-display/
mkdir gh-pages/06.recomposing-ui/d.plain-ui
rsync -av --progress samples/06.recomposing-ui/d.plain-ui/build/ gh-pages/06.recomposing-ui/d.plain-ui/
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: gh-pages/**/*
release:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
id-token: write
pages: write
needs: build
runs-on: ubuntu-latest
steps:
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4