Skip to content

Commit ebc4c34

Browse files
committed
ci: add release workflow with platform binaries
Builds xmllint for linux-x86-64, linux-aarch64, darwin-aarch64, and windows-x86-64 on each v* tag and uploads the binaries as GitHub release assets. Asset naming follows the xmllint_{os}-{arch} convention so package managers (e.g. mise's github: backend) can pick up the right binary automatically. Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent fb67a25 commit ebc4c34

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
build:
13+
name: Build (${{ matrix.target }})
14+
runs-on: ${{ matrix.runner }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- target: x86_64-unknown-linux-gnu
20+
runner: ubuntu-22.04
21+
asset_name: xmllint_linux-x86-64
22+
- target: aarch64-unknown-linux-gnu
23+
runner: ubuntu-22.04
24+
asset_name: xmllint_linux-aarch64
25+
cross: true
26+
- target: aarch64-apple-darwin
27+
runner: macos-latest
28+
asset_name: xmllint_darwin-aarch64
29+
- target: x86_64-pc-windows-msvc
30+
runner: windows-latest
31+
asset_name: xmllint_windows-x86-64.exe
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: dtolnay/rust-toolchain@stable
37+
with:
38+
targets: ${{ matrix.target }}
39+
40+
- uses: Swatinem/rust-cache@v2
41+
with:
42+
key: ${{ matrix.target }}
43+
44+
- name: Install cross
45+
if: matrix.cross
46+
run: cargo install cross --locked
47+
48+
- name: Build (cross)
49+
if: matrix.cross
50+
run: cross build --release --features cli --target ${{ matrix.target }}
51+
52+
- name: Build (native)
53+
if: "!matrix.cross"
54+
run: cargo build --release --features cli --target ${{ matrix.target }}
55+
56+
- name: Rename binary (Unix)
57+
if: runner.os != 'Windows'
58+
run: |
59+
cp target/${{ matrix.target }}/release/xmllint ${{ matrix.asset_name }}
60+
61+
- name: Rename binary (Windows)
62+
if: runner.os == 'Windows'
63+
run: |
64+
Copy-Item "target/${{ matrix.target }}/release/xmllint.exe" "${{ matrix.asset_name }}"
65+
66+
- uses: actions/upload-artifact@v4
67+
with:
68+
name: ${{ matrix.asset_name }}
69+
path: ${{ matrix.asset_name }}
70+
71+
release:
72+
name: Create Release
73+
needs: build
74+
runs-on: ubuntu-latest
75+
permissions:
76+
contents: write
77+
steps:
78+
- uses: actions/download-artifact@v4
79+
with:
80+
merge-multiple: true
81+
82+
- name: Create GitHub Release
83+
uses: softprops/action-gh-release@v2
84+
with:
85+
files: xmllint_*
86+
generate_release_notes: true

0 commit comments

Comments
 (0)