-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.84 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (72 loc) · 2.84 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
name: Release
# Builds prebuilt `rustyred-server` binaries for macOS (arm64 + x86_64),
# Linux (x86_64), and Windows (x86_64) and attaches them to the GitHub
# Release when a vX.Y.Z tag is pushed. Triggered by the maintainer pushing a
# tag; nothing publishes on a normal push.
#
# For the curl|sh installer + Homebrew formula + npm shim, run `dist init`
# (config is staged under [workspace.metadata.dist] in Cargo.toml); cargo-dist
# regenerates this workflow with the full installer ecosystem.
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- { os: macos-14, target: aarch64-apple-darwin }
- { os: macos-13, target: x86_64-apple-darwin }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
runs-on: ${{ matrix.os }}
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Install protobuf-compiler (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends protobuf-compiler
- name: Install protobuf-compiler (macOS)
if: runner.os == 'macOS'
run: brew install protobuf
- name: Install protobuf-compiler (Windows)
if: runner.os == 'Windows'
run: choco install protoc -y
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --locked -p rustyred-server --target ${{ matrix.target }}
- name: Package (unix)
if: runner.os != 'Windows'
shell: bash
run: |
dir="target/${{ matrix.target }}/release"
tar -czf "rustyred-${{ matrix.target }}.tar.gz" -C "$dir" rustyred-server
shasum -a 256 "rustyred-${{ matrix.target }}.tar.gz" > "rustyred-${{ matrix.target }}.tar.gz.sha256"
- name: Package (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$bin = "target/${{ matrix.target }}/release/rustyred-server.exe"
Compress-Archive -Path $bin -DestinationPath "rustyred-${{ matrix.target }}.zip"
(Get-FileHash "rustyred-${{ matrix.target }}.zip" -Algorithm SHA256).Hash | Out-File "rustyred-${{ matrix.target }}.zip.sha256"
- name: Attach to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
rustyred-${{ matrix.target }}.*