Oops #7
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- v2 | |
jobs: | |
publish-extensions: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: "ubuntu-22.04" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
ref: "v2" | |
- name: install dependencies (ubuntu only) | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: make binaryen | |
- name: Install extism-js | |
run: | | |
curl -O https://raw.githubusercontent.com/extism/js-pdk/main/install.sh | |
bash install.sh | |
- name: install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | |
targets: "wasm32-unknown-unknown,wasm32-wasip1" | |
- name: install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "latest" | |
- name: install mopack | |
run: npm install -g @moosync/packer | |
- name: build extensions | |
run: make | |
- name: Get release name | |
id: date | |
run: | | |
echo "{release_name}={Extensions release ($(date +'%Y-%m-%d'))}" >> $GITHUB_STATE | |
- name: Create Release | |
uses: actions/github-script@v2 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
console.log('environment', process.versions); | |
const fs = require('fs').promises; | |
const { repo: { owner, repo }, sha } = context; | |
console.log({ owner, repo, sha }); | |
const release = await github.repos.createRelease({ | |
owner, repo, | |
tag_name: `release-${sha}`, | |
draft: true, | |
target_commitish: sha | |
}); | |
console.log('created release', { release }); | |
for (let file of await fs.readdir('./dist')) { | |
console.log('uploading', file); | |
await github.repos.uploadReleaseAsset({ | |
owner, repo, | |
release_id: release.data.id, | |
name: file, | |
data: await fs.readFile(`./dist/${file}`) | |
}); | |
} |