Repository navigation
98 lines (91 loc) · 3.52 KB
/
Copy pathrelease.yml
File metadata and controls
98 lines (91 loc) · 3.52 KB
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
# Checks every push to dev and master and every pull request. A pushed `vX.Y.Z` tag, on the commit that sets that
# version in Cargo.toml, also becomes a release with a binary per platform, which `<Leader>pu` (`:upgrade`)
# downloads. A change to the docs alone is not checked.
name: Release
on:
push:
branches: [master, dev]
tags: ["v*"]
paths-ignore: ["docs/**", "**.md", LICENSE]
pull_request:
paths-ignore: ["docs/**", "**.md", LICENSE]
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
check:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal --component clippy,rustfmt
- run: cargo fmt --check
- run: cargo clippy --all-targets -- -D warnings
# The perf budgets are set for a dev machine; shared runners are slower and noisy, so they run locally only.
- run: "cargo test -- --skip perf::"
# The binaries report Cargo.toml's version, so it must be the tag's, or `<Leader>pu` would offer the release forever.
version:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n 1)
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
echo "::error::tag $GITHUB_REF_NAME but Cargo.toml says $version"
exit 1
fi
# Asset names are lim-{ARCH}-{OS}{EXE_SUFFIX} from std::env::consts, as src/update.rs looks them up.
build:
needs: [check, version]
strategy:
matrix:
include:
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu, asset: lim-x86_64-linux }
- { os: ubuntu-22.04-arm, target: aarch64-unknown-linux-gnu, asset: lim-aarch64-linux }
- { os: macos-latest, target: aarch64-apple-darwin, asset: lim-aarch64-macos }
- { os: macos-latest, target: x86_64-apple-darwin, asset: lim-x86_64-macos }
- { os: windows-latest, target: x86_64-pc-windows-msvc, asset: lim-x86_64-windows.exe }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal --target ${{ matrix.target }}
- run: cargo build --release --locked --target ${{ matrix.target }}
- name: Name the binary
shell: bash
run: |
for bin in lim lim-gui; do
exe=target/${{ matrix.target }}/release/$bin
[ -f "$exe.exe" ] && exe="$exe.exe"
asset="${{ matrix.asset }}"
cp "$exe" "$bin${asset#lim}"
done
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: |
${{ matrix.asset }}
lim-gui-*
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist # not assets/: the repo has an assets/ folder
merge-multiple: true
- name: Release
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
gh release upload "$GITHUB_REF_NAME" dist/* --clobber
else
gh release create "$GITHUB_REF_NAME" dist/* --verify-tag --title "lim $GITHUB_REF_NAME" --generate-notes
fi