Skip to content

Commit

Permalink
fix: change ./build directory to build branch and deploy gh-pages w…
Browse files Browse the repository at this point in the history
…ith actions (PR #12)

create a build.yml action to install/build and deploy to a specific
`build` branch, allow to not populate source code with build output.

create a gh-pages.yml action to deploy gh-pages manually, install/build
and push the demo folder to actions/upload-pages-artifact and then
deploy to actions/deploy-pages.

test folder is build to ./build and run with `npm run test`
  • Loading branch information
panaC authored Dec 2, 2024
1 parent fc8e494 commit 996bc7c
Show file tree
Hide file tree
Showing 30 changed files with 426 additions and 1,957 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Simple workflow for deploying static content to GitHub Pages
name: Build and commit to `build` branch

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write

# 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: "build"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Node build
uses: actions/setup-node@v4
with:
node-version: 22
- run: |
npm ci --foreground-scripts
npm run build
ls -la ./
ls -laR ./build
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
# If you're changing the branch from main,
# also change the `main` in `refs/heads/main`
# below accordingly.
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
publish_branch: build # default: gh-pages
destination_dir: ./
enable_jekyll: true # do not write .nojekyll empty file
61 changes: 61 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy demo page to gh-pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# 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

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Node build
uses: actions/setup-node@v4
with:
node-version: 22
- run: |
npm ci --foreground-scripts
npm run build
ls -la ./
ls -laR ./build
ls -laR ./demo
mkdir build-demo
cp -r ./build ./build-demo/
cp -r ./demo ./build-demo/
ls -laR ./build-demo
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "./build-demo"

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '22'
- name: Install dependencies
run: npm ci
run: npm ci --foreground-scripts
- name: Run Build
run: npm run build
- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules/
script/web-speech-recommended-voices/
.DS_Store
build/
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,19 @@ It demonstrates the following features:

## QuickStart

`npm install https://github.com/readium/speech`
`npm install https://github.com/readium/speech#build`

```
import { getVoices } from "readium-speech";
// or with cjs only :
import { getVoices } from "readium-speech/build/cjs/voices";
// or with esm mjs :
import { getVoices } from "readium-speech/build/mjs/src/voices";
const voices = await getVoices();
console.log(voices);
import { voicesSelection} from "readium-speech";
console.log(voicesSelection);
// or with cjs only :
const { getVoices } = require("readium-speech/cjs/voices.js");
console.log(getVoices);
// or
import { voicesSelection } from "readium-speech/build/cjs";
import { voicesSelection } from "readium-speech/build/mjs";
// or with esm mjs :
import { getVoices } from "readium-speech/mjs/voices.js";
console.log(getVoices);
const voices = await voicesSelection.getVoices();
console.log(voices);
Expand Down
201 changes: 0 additions & 201 deletions build/cjs/data.gen.d.ts

This file was deleted.

13 changes: 0 additions & 13 deletions build/cjs/data.gen.js

This file was deleted.

1 change: 0 additions & 1 deletion build/cjs/index.d.ts

This file was deleted.

27 changes: 0 additions & 27 deletions build/cjs/index.js

This file was deleted.

Loading

0 comments on commit 996bc7c

Please sign in to comment.