Demo player update #42
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: Demo player update | |
env: | |
HUSKY: 0 | |
on: workflow_dispatch | |
jobs: | |
publish-demo: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
env: | |
CYPRESS_INSTALL_BINARY: 0 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build | |
- name: Fill updater.json | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { createWriteStream } = require("node:fs"); | |
const { pipeline } = require("node:stream/promises"); | |
const release = await github.rest.repos.getLatestRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}); | |
const latestAsset = release.data.assets.find(asset => asset.name === 'latest.json'); | |
const assetContent = await github.rest.repos.getReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
asset_id: latestAsset.id, | |
headers: { | |
accept: "application/octet-stream", | |
}, | |
request: { | |
parseSuccessResponseBody: false, // required to access response as stream | |
}, | |
}); | |
const assetStream = assetContent.data; | |
const outputFile = createWriteStream("./dist/apps/player/updater.json"); | |
await pipeline(assetStream, outputFile); | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: dist/apps/player | |
clean: true | |
clean-exclude: | | |
.nojekyll |