Fix for web worker MIME type error #15
This file contains hidden or 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: Balanced ternary to decimal pipeline | |
permissions: | |
contents: write | |
pages: write | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Transpile web worker TypeScript | |
run: | | |
if ! npm list typescript > /dev/null 2>&1; then | |
npm install --no-save typescript | |
fi | |
npx tsc public/web-worker.ts --target es2020 --module es2020 --outDir public --skipLibCheck | |
rm -f public/web-worker.ts | |
- name: Build Astro project | |
run: npm run build | |
- name: Cache build output | |
uses: actions/cache@v3 | |
with: | |
path: dist | |
key: ${{ runner.os }}-astro-build-${{ github.sha }} | |
deploy: | |
name: Deploy to GitHub Pages | |
needs: build | |
if: | | |
github.event_name == 'push' && | |
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Transpile web worker TypeScript | |
run: | | |
if ! npm list typescript > /dev/null 2>&1; then | |
npm install --no-save typescript | |
fi | |
npx tsc public/web-worker.ts --target es2020 --module es2020 --outDir public --skipLibCheck | |
rm -f public/web-worker.ts | |
- name: Restore cached build | |
uses: actions/cache@v3 | |
with: | |
path: dist | |
key: ${{ runner.os }}-astro-build-${{ github.sha }} | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: dist | |
clean: true | |
token: ${{ secrets.GITHUB_TOKEN }} |