-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (86 loc) · 2.93 KB
/
release.yml
File metadata and controls
99 lines (86 loc) · 2.93 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
# cargo-dist release workflow
# Triggered when release-plz pushes a version tag (e.g., v1.3.1)
# Builds binaries for all targets and uploads to GitHub Releases
name: Release
permissions:
contents: write
on:
push:
tags:
- 'v[0-9]+.*'
jobs:
# Create the GitHub Release so that build jobs can upload to it
create-release:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Get tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
generate_release_notes: true
draft: false
prerelease: false
# Build binaries for each target
build:
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
env:
ARCHIVE_NAME: tinycloud-node-${{ matrix.target }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (aarch64-linux)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }} -p tinycloud-node
- name: Package binary (unix)
run: |
mkdir -p "$ARCHIVE_NAME"
cp "target/${{ matrix.target }}/release/tinycloud" "$ARCHIVE_NAME/"
cp LICENSE.md README.md CHANGELOG.md "$ARCHIVE_NAME/" 2>/dev/null || true
tar czf "$ARCHIVE_NAME.tar.gz" "$ARCHIVE_NAME"
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.create-release.outputs.tag }}
files: |
${{ env.ARCHIVE_NAME }}.tar.gz
# Announce completion after all builds succeed
publish-complete:
needs: [create-release, build]
runs-on: ubuntu-latest
if: always()
steps:
- name: Report status
run: |
if [ "${{ needs.build.result }}" = "success" ]; then
echo "All release artifacts uploaded successfully for ${{ needs.create-release.outputs.tag }}"
else
echo "Some builds failed — check the workflow run for details"
exit 1
fi