Skip to content

Commit

Permalink
Use official GitHub Actions for live viewer deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed Nov 5, 2023
1 parent bd27527 commit 3f5e1a0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 22 deletions.
22 changes: 2 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Build
on:
pull_request:
branches:
- main
branches: [main]
push:
branches:
- main
branches: [main]
jobs:
build:
name: Lint and tests
Expand All @@ -25,19 +23,3 @@ jobs:
- run: npm ci
- run: npm run lint
- run: npm test
deploy:
name: Live viewer
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- name: Build Live Viewer
run: bash scripts/deploy-live-viewer.sh
- name: Push to gh-pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Live Viewer

on:
push:
branches: [main]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build into _site
run: bash scripts/deploy-live-viewer.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ lib/Function.js
lib/URL.js
lib/URLSearchParams.js
lib/utils.js
_site/
4 changes: 2 additions & 2 deletions scripts/deploy-live-viewer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ cd "$(dirname "$0")"

npm run build-live-viewer

mkdir -p ../out
cp -r ../live-viewer/* ../out # exclude files starting with . by using /*
mkdir -p ../_site
cp -r ../live-viewer/* ../_site # exclude files starting with . by using /*

0 comments on commit 3f5e1a0

Please sign in to comment.