-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (113 loc) · 3.92 KB
/
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Cross Build and Release
on:
workflow_dispatch:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
jobs:
build-windows:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
toolchain: stable
target: x86_64-pc-windows-gnu
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build for Windows
run: cross build --release --target x86_64-pc-windows-gnu
- name: Create artifacts directory
run: mkdir artifacts
- name: Copy binary to artifacts
run: cp target/x86_64-pc-windows-gnu/release/jobshell.exe artifacts/
- name: Upload Windows binary
uses: actions/upload-artifact@v3
with:
name: windows-artifacts
path: artifacts/
build-macos:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
toolchain: stable
- name: Add macOS targets
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
- name: Create artifacts directory
run: mkdir artifacts
- name: Build for macOS (x86_64)
run: cargo build --release --target x86_64-apple-darwin
- name: Copy x86_64 binary
run: cp target/x86_64-apple-darwin/release/jobshell artifacts/jobshell-x86_64
- name: Build for macOS (aarch64)
run: cargo build --release --target aarch64-apple-darwin
- name: Copy aarch64 binary
run: cp target/aarch64-apple-darwin/release/jobshell artifacts/jobshell-aarch64
- name: Upload macOS binaries
uses: actions/upload-artifact@v3
with:
name: macos-artifacts
path: artifacts/
release:
needs: [build-windows, build-macos]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create release directory
run: mkdir release-binaries
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: release-binaries
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
- name: Upload Windows Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release-binaries/windows-artifacts/jobshell.exe
asset_name: jobshell-windows-x86_64.exe
asset_content_type: application/octet-stream
- name: Upload macOS x86_64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release-binaries/macos-artifacts/jobshell-x86_64
asset_name: jobshell-macos-x86_64
asset_content_type: application/octet-stream
- name: Upload macOS aarch64 Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release-binaries/macos-artifacts/jobshell-aarch64
asset_name: jobshell-macos-aarch64
asset_content_type: application/octet-stream