-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (80 loc) · 3 KB
/
Copy pathbuild.yml
File metadata and controls
97 lines (80 loc) · 3 KB
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
name: Build and Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
default: '1.0.0'
jobs:
create_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
draft: true
prerelease: false
build:
runs-on: ${{ matrix.runners.image }}
needs: create_release
strategy:
matrix:
runners:
- name: macos-aarch64
image: macos-latest
target: aarch64-apple-darwin
artifact: server-runner
- name: macos-x86-64
image: macos-latest
target: x86_64-apple-darwin
artifact: server-runner
- name: linux-x86-64
image: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: server-runner
- name: linux-aarch64
image: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact: server-runner
- name: windows-x86-64
image: windows-latest
target: x86_64-pc-windows-msvc
artifact: server-runner.exe
- name: windows-aarch64
image: windows-latest
target: aarch64-pc-windows-msvc
artifact: server-runner.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Linux aarch64 gcc
if: ${{ matrix.runners.name == 'linux-aarch64' }}
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Install build target
run: rustup target add ${{ matrix.runners.target }}
- name: Build
run: cargo build --release --target=${{ matrix.runners.target }}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: server-runner-${{ inputs.version }}-${{ matrix.runners.name }}
path: target/${{ matrix.runners.target }}/release/${{ matrix.runners.artifact }}
- name: Compress artifact ${{ matrix.runners.name }}
run: tar -czf server-runner-${{ github.event.inputs.version }}-${{ matrix.runners.name }}.tar.gz -C ./target/${{ matrix.runners.target }}/release ${{ matrix.runners.artifact }}
- name: Upload Release Asset ${{ matrix.runners.name }}
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
files: ./server-runner-${{ github.event.inputs.version }}-${{ matrix.runners.name }}.tar.gz