-
Notifications
You must be signed in to change notification settings - Fork 8
75 lines (65 loc) · 2.5 KB
/
release.yml
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
name: Build binaries and create release
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-13
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get the tag name
id: get_tag
run: |
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build release binary
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: |
cargo build --release --target ${{ matrix.target }}
- name: Get OS and architecture
run: |
echo "OS=$(echo ${{ matrix.target }} | grep -q 'linux' && echo 'linux' || echo 'darwin')" >> $GITHUB_ENV
echo "ARCH=$(echo ${{ matrix.target }} | grep -q 'aarch64' && echo 'arm64' || echo 'x86_64')" >> $GITHUB_ENV
- name: Create release archive
run: |
mkdir -p spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}
cp target/${{ matrix.target }}/release/spaced spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}/spaced
cp target/${{ matrix.target }}/release/space-cli spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}/space-cli
tar -czf spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }} # Dynamically use the pushed tag
name: Release ${{ env.TAG }} # Use the tag for the release name
body: |
Spaces release of version ${{ env.TAG }}.
draft: false
prerelease: false
files: |
spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}