-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (56 loc) · 1.97 KB
/
build-and-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
name: Rust build-and-release
on:
workflow_dispatch: # Manually triggered
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Install Rust target
run: rustup target add ${{ matrix.target }}
- name: Install cross (for cross-compilation)
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
run: cross build --release --target=${{ matrix.target }}
- name: Get Version from Cargo.toml
id: cargo_version
run: |
THE_VERSION_STRING=$(cargo pkgid | cut -d@ -f2 | cut -d: -f2)
echo "t_cargo_version=$THE_VERSION_STRING" >> $GITHUB_ENV
- name: Zip Binary
uses: vimtor/action-zip@v1
with:
files: target/${{ matrix.target }}/release/limonium
dest: target/${{ matrix.target }}/release/limonium-${{ matrix.target }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: limonium-${{ matrix.target }}
path: target/${{ matrix.target }}/release/limonium-${{ matrix.target }}.zip
release:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Set Version from Cargo.toml
id: cargo_version
run: |
THE_VERSION_STRING=$(cargo pkgid | cut -d@ -f2 | cut -d: -f2)
echo "t_cargo_version=$THE_VERSION_STRING" >> $GITHUB_ENV
- name: Deploy Release With Artifacts
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.t_cargo_version }}" # Now using the extracted version
prerelease: false
files: artifacts/**