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
name: Release
# Builds prebuilt binaries for every tagged version and attaches them to the
# GitHub Release, so users without a Rust toolchain can install in one step.
on:
push:
tags:
permissions:
contents: write
jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# Both macOS targets build on the Apple Silicon runner: the macOS SDK
# is universal, so it cross-compiles x86_64 reliably. The dedicated
# Intel runner (macos-13) is being deprecated and queues for hours.
- os: macos-14
target: aarch64-apple-darwin
- os: macos-14
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }} --bin sessionwiki
- name: Package (unix)
if: runner.os != 'Windows'
shell: bash
run: |
bin=target/${{ matrix.target }}/release/sessionwiki
dist=sessionwiki-${{ github.ref_name }}-${{ matrix.target }}
mkdir "$dist"
cp "$bin" "$dist/"
cp README.md LICENSE "$dist/"
tar czf "$dist.tar.gz" "$dist"
shasum -a 256 "$dist.tar.gz" > "$dist.tar.gz.sha256"
- name: Package (windows)
if: runner.os == 'Windows'
shell: bash
run: |
bin=target/${{ matrix.target }}/release/sessionwiki.exe
dist=sessionwiki-${{ github.ref_name }}-${{ matrix.target }}
mkdir "$dist"
cp "$bin" "$dist/"
cp README.md LICENSE "$dist/"
7z a "$dist.zip" "$dist" >/dev/null
certutil -hashfile "$dist.zip" SHA256 | sed -n 2p > "$dist.zip.sha256"
- name: Build the release notes
shell: bash
run: |
# The release was published with an EMPTY body while CHANGELOG.md
# carried the notes, so every version looked the same on GitHub: a
# version number and nothing else. Every matrix leg writes the same
# file, so whichever uploads first sets the same body.
TAG="${{ github.ref_name }}"
sh scripts/release-notes.sh "$TAG" > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
echo "CHANGELOG.md has no section for $TAG" >&2
exit 1
fi
- name: Upload to release
uses: softprops/action-gh-release@v3
with:
body_path: RELEASE_NOTES.md
files: |
sessionwiki-*.tar.gz
sessionwiki-*.tar.gz.sha256
sessionwiki-*.zip
sessionwiki-*.zip.sha256
fail_on_unmatched_files: false