Skip to content

v0.3.9

v0.3.9 #47

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
jobs:
build-artifacts:
strategy:
matrix:
include:
# x86
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
kind: full
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
kind: bare
- os: macos-latest
target: x86_64-apple-darwin
kind: bare
## TODO: Windows needs specific configuration to find
## NPM globally installed binaries, and I couldn't figure
## it out in ~30 minutes. Deal with this later.
# - os: windows-latest
# target: x86_64-pc-windows-msvc
# ARM
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
kind: bare
- os: macos-latest
target: aarch64-apple-darwin
kind: bare
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/setup
with:
target: ${{ matrix.target }}
- name: Build Rust package
run: cargo build -p mdbook-quiz --release --locked ${{ matrix.kind == 'full' && '--features rust-editor --features aquascope' || '' }}
- name: Package artifact
run: tar -czf mdbook-quiz_${{ matrix.target }}_${{ matrix.kind }}.tar.gz mdbook-quiz
working-directory: target/release
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}_${{ matrix.kind }}
path: target/release/mdbook-quiz_${{ matrix.target }}_${{ matrix.kind }}.tar.gz
build-schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/setup
- name: Build schema
run: cargo run --bin gen-json-schema --features json-schema > mdbook-quiz.schema.json
- uses: actions/upload-artifact@v4
with:
name: schema
path: mdbook-quiz.schema.json
publish-artifacts:
needs: [build-artifacts, build-schema]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- uses: softprops/action-gh-release@v1
with:
files: |
x86_64-unknown-linux-gnu_full/mdbook-quiz_x86_64-unknown-linux-gnu_full.tar.gz
x86_64-unknown-linux-gnu_bare/mdbook-quiz_x86_64-unknown-linux-gnu_bare.tar.gz
x86_64-apple-darwin_bare/mdbook-quiz_x86_64-apple-darwin_bare.tar.gz
aarch64-unknown-linux-gnu_bare/mdbook-quiz_aarch64-unknown-linux-gnu_bare.tar.gz
aarch64-apple-darwin_bare/mdbook-quiz_aarch64-apple-darwin_bare.tar.gz
schema/mdbook-quiz.schema.json
publish-crate:
needs: publish-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./.github/workflows/setup
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-workspaces
# This ensures that the `crates/mdbook-quiz/js/` directory is
# populated before running publish
- name: Cargo build
run: cargo build
- name: Install mdbook-quiz
run: cargo install --path crates/mdbook-quiz --debug --locked
- name: Build example mdbook
run: mdbook build
working-directory: example/mdbook
- name: Cargo release
run: cargo workspaces publish --from-git --yes --allow-dirty --token ${{ secrets.CARGO_TOKEN }}
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./js/packages/quiz/package.json
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./example/mdbook/book