build #5
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: "build" | |
on: [push, workflow_dispatch] | |
env: | |
EM_VERSION: 3.1.43 | |
EM_CACHE_FOLDER: 'emsdk-cache' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup cache | |
id: cache-system-libraries | |
uses: actions/cache@v4 | |
with: | |
path: ${{env.EM_CACHE_FOLDER}} | |
key: ${{env.EM_VERSION}}-${{ runner.os }} | |
- uses: mymindstorm/setup-emsdk@v14 | |
with: | |
version: ${{env.EM_VERSION}} | |
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Build library | |
run: | | |
emcc --version; | |
cmake --version; | |
make; | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: plugins | |
path: plugins/* | |
- name: Make package | |
run: npm pack | |
- name: Update sid release assets and text | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const fs = require('fs'); | |
const path = require('path'); | |
const { owner, repo } = context.repo; | |
let sid_release = await github.rest.repos.getReleaseByTag({ | |
owner, | |
repo, | |
tag: "sid" | |
}); | |
await github.rest.repos.updateRelease({ | |
owner, | |
repo, | |
release_id: sid_release.data.id, | |
body: "A persistent prerelease where build artifacts for the current tip will be deposited\n\n## Last updated: " + (new Date()).toDateString() | |
}); | |
// delete existing release assets (if needed) and upload new ones: | |
const globber = await glob.create("h5wasm*.tgz", {followSymbolicLinks: false}); | |
const full_paths = await globber.glob(); | |
console.log({full_paths}); | |
for (let p of full_paths) { | |
const fn = path.basename(p); | |
let asset_id = (sid_release.data.assets.find((a) => (a.name == fn)) ?? {}).id; | |
if (asset_id) { | |
await github.rest.repos.deleteReleaseAsset({ | |
owner, | |
repo, | |
asset_id | |
}); | |
} | |
await github.rest.repos.uploadReleaseAsset({ | |
owner, | |
repo, | |
release_id: sid_release.data.id, | |
name: fn, | |
data: await fs.readFileSync(p) | |
}); | |
} |