Add preversion/postversion script for propagating versions in npm wor… #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- 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/ | |
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/public/ 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/public/ 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/public/ 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/public/ 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 \ | |
--exclude e.extending-ui | |
mkdir gh-pages/06.recomposing-ui/a.minimizable-web-chat | |
rsync -av --progress samples/06.recomposing-ui/a.minimizable-web-chat/public/ 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/public/ 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/public/ 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/public/ gh-pages/06.recomposing-ui/d.plain-ui/ | |
mkdir gh-pages/06.recomposing-ui/e.extending-ui | |
rsync -av --progress samples/06.recomposing-ui/e.extending-ui/public/ gh-pages/06.recomposing-ui/e.extending-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 |