-
Notifications
You must be signed in to change notification settings - Fork 4
165 lines (135 loc) · 3.98 KB
/
release-pipeline.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release Pipeline
on:
workflow_dispatch:
permissions:
contents: write
jobs:
# Build for Windows
build_windows:
runs-on: windows-latest # Use Windows runner
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy
- name: Build for Windows
run: |
cargo build --release
mkdir -p output/win
cp target/release/aid.exe output/win/aid-win.exe
- name: Upload Windows artifact
uses: actions/upload-artifact@v3
with:
name: windows-artifact
path: output/win/aid-win.exe
# Build for Linux x86_64
build_linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy
- name: Build for Linux
run: |
cargo build --release
mkdir -p output/linux
cp target/release/aid output/linux/aid-linux
- name: Upload Linux artifact
uses: actions/upload-artifact@v3
with:
name: linux-artifact
path: output/linux/aid-linux
# Build for macOS x86_64
build_macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy
- name: Build for macOS
run: |
cargo build --release
mkdir -p output/osx
cp target/release/aid output/osx/aid-mac
- name: Upload macOS artifact
uses: actions/upload-artifact@v3
with:
name: macos-artifact
path: output/osx/aid-mac
# Build for macOS ARM (Apple Silicon)
build_macos_arm:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: aarch64-apple-darwin # Add macOS ARM target
components: clippy
- name: Build for macOS ARM
run: |
cargo build --release --target aarch64-apple-darwin
mkdir -p output/osx_arm
cp target/aarch64-apple-darwin/release/aid output/osx_arm/aid-mac-arm
- name: Upload macOS ARM artifact
uses: actions/upload-artifact@v3
with:
name: macos-arm-artifact
path: output/osx_arm/aid-mac-arm
# Create a single GitHub release with all artifacts
create_release:
runs-on: ubuntu-latest
needs: [build_windows, build_linux, build_macos, build_macos_arm]
steps:
- name: Checkout code
uses: actions/checkout@v2
# Download artifacts from previous jobs
- name: Download Windows artifact
uses: actions/download-artifact@v3
with:
name: windows-artifact
- name: Download Linux artifact
uses: actions/download-artifact@v3
with:
name: linux-artifact
- name: Download macOS artifact
uses: actions/download-artifact@v3
with:
name: macos-artifact
- name: Download macOS ARM artifact
uses: actions/download-artifact@v3
with:
name: macos-arm-artifact
- name: Generate release tag
id: tag
run: |
VERSION=0.1.6
echo "::set-output name=release_tag::aid-${VERSION}"
- name: Create GitHub release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
files: |
aid-win.exe
aid-linux
aid-mac
aid-mac-arm