Skip to content

Commit 7c5fedb

Browse files
Add release workflow
1 parent ca683f0 commit 7c5fedb

2 files changed

Lines changed: 68 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
release-binary:
9+
strategy:
10+
matrix:
11+
package: [mdbook-tabs, mdbook-trunk]
12+
include:
13+
- target: aarch64-unknown-linux-gnu
14+
os: ubuntu-latest
15+
- target: aarch64-unknown-linux-musl
16+
os: ubuntu-latest
17+
- target: x86_64-unknown-linux-gnu
18+
os: ubuntu-latest
19+
- target: x86_64-unknown-linux-musl
20+
os: ubuntu-latest
21+
- target: aarch64-apple-darwin
22+
os: macos-latest
23+
- target: x86_64-apple-darwin
24+
os: macos-latest
25+
- target: x86_64-pc-windows-msvc
26+
os: windows-latest
27+
runs-on: ${{ matrix.os }}
28+
name: Release ${{ matrix.package }} for ${{ matrix.target }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Rust toolchain
33+
env:
34+
TARGET: ${{ matrix.target }}
35+
run: rustup toolchain install stable --no-self-update --profile minimal --component rust-std-$TARGET
36+
37+
- name: Set up Rust cache
38+
uses: swatinem/rust-cache@v2
39+
with:
40+
cache-on-failure: true
41+
save-if: ${{ github.ref == 'refs/heads/main' }}
42+
43+
- name: Build
44+
run: cargo build --bins --locked --release --target ${{ matrix.target }}
45+
46+
- name: Archive (tar.gz)
47+
if: ${{ !contains(matrix.os, 'windows') }}
48+
run: tar czf ../../${{ matrix.package }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ${{ matrix.package }}
49+
working-directory: target/${{ matrix.target }}/release
50+
51+
- name: Archive (zip)
52+
if: ${{ contains(matrix.os, 'windows') }}
53+
run: 7z a ../../${{ matrix.package }}-${{ github.ref_name }}-${{ matrix.target }}.zip ${{ matrix.package }}.exe
54+
working-directory: target/${{ matrix.target }}/release
55+
56+
- name: Upload release asset (tar.gz)
57+
if: ${{ !contains(matrix.os, 'windows') }}
58+
uses: softprops/action-gh-release@v2
59+
with:
60+
files: ${{ matrix.package }}-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
61+
62+
- name: Upload release asset (zip)
63+
if: ${{ contains(matrix.os, 'windows') }}
64+
uses: softprops/action-gh-release@v2
65+
with:
66+
files: ${{ matrix.package }}-${{ github.ref_name }}-${{ matrix.target }}.zip

.github/workflows/website.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
- name: Install Cargo Binary Install
3131
uses: cargo-bins/cargo-binstall@main
3232

33-
- name: Install mdBook
34-
run: cargo binstall -y mdbook
33+
- name: Install mdBook and Trunk
34+
run: cargo binstall -y mdbook trunk
3535

3636
- name: Run tests
3737
run: mdbook test

0 commit comments

Comments
 (0)