Skip to content

Commit 3ce6d09

Browse files
committed
build: add GitHub Actions workflow for automated build and release of binaries
1 parent d4311ef commit 3ce6d09

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/release.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
10+
jobs:
11+
build:
12+
name: Build and Release binaries
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
target:
18+
- x86_64-unknown-linux-gnu
19+
- x86_64-pc-windows-gnu
20+
- x86_64-apple-darwin
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Rust
27+
uses: actions-rs/toolchain@v1
28+
with:
29+
toolchain: stable
30+
target: ${{ matrix.target }}
31+
32+
- name: Build
33+
run: cargo build --release --target ${{ matrix.target }}
34+
35+
- name: Archive
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: xstats-${{ matrix.target }}
39+
path: target/${{ matrix.target }}/release/xstats
40+
41+
release:
42+
name: Create a new release
43+
needs: build
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Download artifacts
51+
uses: actions/download-artifact@v3
52+
with:
53+
name: xstats-${{ matrix.target }}
54+
path: artifacts
55+
56+
- name: Create Release
57+
uses: ncipollo/release-action@v1
58+
with:
59+
artifacts: |
60+
artifacts/xstats-x86_64-unknown-linux-gnu
61+
artifacts/xstats-x86_64-pc-windows-gnu
62+
artifacts/xstats-x86_64-apple-darwin
63+
token: ${{ secrets.GITHUB_TOKEN }}
64+
tag: ${{ github.ref_name }}
65+
name: Release ${{ github.ref_name }}
66+
body: |
67+
## xStats CLI Tool v${{ github.ref_name }}
68+
Precompiled binaries for Linux, Windows, and macOS.

0 commit comments

Comments
 (0)