-
Notifications
You must be signed in to change notification settings - Fork 23
103 lines (97 loc) · 3.47 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Release
on:
push:
tags:
- "v*"
jobs:
build-artifacts:
strategy:
matrix:
include:
# x86
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
## 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
- os: macos-latest
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
profile: minimal
override: true
- name: Install cargo-make
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-make
- name: Install Depot
run: |
curl https://raw.githubusercontent.com/cognitive-engineering-lab/depot/main/scripts/install.sh | sh
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
- name: Initialize TS bindings
run: cargo make init-bindings
- name: Build Rust package
run: cargo build -p mdbook-quiz --release --locked
- name: Package artifact
run: tar -czf mdbook-quiz-${{ matrix.target }}.tar.gz mdbook-quiz
working-directory: target/release
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.target }}
path: target/release/mdbook-quiz-${{ matrix.target }}.tar.gz
publish-artifacts:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- uses: softprops/action-gh-release@v1
with:
files: |
x86_64-unknown-linux-gnu/mdbook-quiz-x86_64-unknown-linux-gnu.tar.gz
x86_64-apple-darwin/mdbook-quiz-x86_64-apple-darwin.tar.gz
aarch64-unknown-linux-gnu/mdbook-quiz-aarch64-unknown-linux-gnu.tar.gz
aarch64-apple-darwin/mdbook-quiz-aarch64-apple-darwin.tar.gz
publish-crate:
needs: publish-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup
uses: ./.github/workflows/setup
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-workspaces
- 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: Install mdbook
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "$(pwd)/bin" >> ${GITHUB_PATH}
- name: Install mdbook-quiz
run: cargo install --path crates/mdbook-quiz --debug --locked
- name: Build example mdbook
run: mdbook build
working-directory: example
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./example/book