-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (112 loc) · 4.09 KB
/
release.yaml
File metadata and controls
132 lines (112 loc) · 4.09 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Release workflow for cargo-rail
#
# Triggered by pushing a version tag (v0.1.0, v1.0.0, etc.)
#
# This workflow builds pre-built binaries and uploads them to GitHub Releases.
# The version bump, changelog, tagging, and crates.io publish are done locally
# via `cargo rail release run cargo-rail --bump <version>`.
#
# Workflow:
# LOCAL: cargo rail release run cargo-rail --bump 0.1.0
# git push origin main --follow-tags
# CI: This workflow triggers, builds binaries, attaches to release
name: Release
permissions:
contents: read
on:
push:
tags:
- v[0-9]+.*
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# ==========================================================================
# Job 1: Create GitHub Release
# ==========================================================================
create-release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Create GitHub Release
uses: taiki-e/create-gh-release-action@b7abb0cf5e72cb5500307b577f9ca3fd4c5be9d2 # v1.8.4
with:
changelog: CHANGELOG.md
token: ${{ secrets.GITHUB_TOKEN }}
# ==========================================================================
# Job 2: Build and upload pre-built binaries
# ==========================================================================
upload-assets:
name: Build (${{ matrix.target }})
needs: create-release
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64 (glibc)
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
# Linux x86_64 (musl) - static, portable
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
# Linux ARM64 (glibc)
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
# Linux ARM64 (musl) - static, portable
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
# Windows x86_64
- target: x86_64-pc-windows-msvc
os: windows-2022
# Windows ARM64
- target: aarch64-pc-windows-msvc
os: windows-2022
# macOS ARM64 (Apple Silicon)
- target: aarch64-apple-darwin
os: macos-14
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Install Rust
uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e # master
with:
toolchain: stable
- name: Setup cross-compilation
uses: taiki-e/setup-cross-toolchain-action@bdeb9ca6f0f909ea36bb94e1e3ec916b2ceb35fc # v1.26.0
with:
target: ${{ matrix.target }}
# Static linking for musl targets (portable binaries)
- name: Configure static linking (musl)
if: contains(matrix.target, '-linux-musl')
run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static -C link-self-contained=yes" >> "$GITHUB_ENV"
shell: bash
# Static linking for Windows (no MSVC runtime dependency)
- name: Configure static linking (Windows)
if: contains(matrix.target, '-windows-msvc')
run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "$GITHUB_ENV"
shell: bash
# macOS deployment target
- name: Set macOS deployment target
if: matrix.target == 'aarch64-apple-darwin'
run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> "$GITHUB_ENV"
- name: Build and upload binary
uses: taiki-e/upload-rust-binary-action@e7953b6078194a4ae5f5619632e3715db6275561 # v1.24.0
with:
bin: cargo-rail
target: ${{ matrix.target }}
tar: all
zip: windows
token: ${{ secrets.GITHUB_TOKEN }}