-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (103 loc) · 3.5 KB
/
cross-build.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
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
name: Rust Cross Compile Binary Release
on:
push:
tags:
- "*"
jobs:
build-linux:
name: Build and Release for Linux
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install cross
run: |
sudo apt-get install -y qemu-user
cargo install cross
- name: Build
run: |
rustup target add ${{ matrix.target }}
cross build --target ${{ matrix.target }} --release
mkdir -p ./artifacts
mv ./target/${{ matrix.target }}/release/stimmgabel ./artifacts/stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
path: ./artifacts/stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
build-windows:
name: Build and Release for Windows
runs-on: windows-latest
strategy:
matrix:
target:
- x86_64-pc-windows-gnu
- aarch64-pc-windows-msvc
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust
run: |
choco install rustup.install
rustup install stable
rustup update stable
rustup default stable
rustup target add ${{ matrix.target }}
- name: Build
run: |
cargo build --target ${{ matrix.target }} --release
mkdir .\artifacts
move .\target\${{ matrix.target }}\release\stimmgabel.exe .\artifacts\stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}.exe
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}.exe
path: .\artifacts\stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}.exe
build-macos:
name: Build and Release for MacOS
runs-on: macos-latest
strategy:
matrix:
target:
- aarch64-apple-darwin
- x86_64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
rustup target add ${{ matrix.target }}
cargo build --target ${{ matrix.target }} --release
mkdir -p ./artifacts
mv ./target/${{ matrix.target }}/release/stimmgabel ./artifacts/stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
path: ./artifacts/stimmgabel-${{ matrix.target }}-${{ github.event.inputs.tag }}
release:
name: Release
needs: [build-linux, build-macos, build-windows]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts/
- name: Create and upload a Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: "Release ${{ github.ref }}"
files: |
./artifacts/*