-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (97 loc) · 3.46 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
# YAML
name: Build and Release
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
- target: aarch64-apple-darwin
runs-on: macos-latest
- target: aarch64-unknown-linux-gnu
runs-on: ubuntu-latest
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install compiler tools (cross-compiling)
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: sudo apt install -y gcc-aarch64-linux-gnu
- name: Setup caching
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Create Artifact
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/header dist/header-${{ matrix.target }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: header-${{ matrix.target }}
path: dist
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.run_id }}
release_name: Release ${{ github.run_id }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/header-x86_64-unknown-linux-gnu/header-x86_64-unknown-linux-gnu
asset_name: header-x86_64-unknown-linux-gnu
asset_content_type: application/octet-stream
- name: Upload Release Asset 2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/header-aarch64-apple-darwin/header-aarch64-apple-darwin
asset_name: header-aarch64-apple-darwin
asset_content_type: application/octet-stream
- name: Upload Release Asset 3
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/header-x86_64-pc-windows-gnu/header-x86_64-pc-windows-gnu
asset_name: header-x86_64-pc-windows-gnu
asset_content_type: application/octet-stream
- name: Upload Release Asset 4
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/header-aarch64-unknown-linux-gnu/header-aarch64-unknown-linux-gnu
asset_name: header-aarch64-unknown-linux-gnu
asset_content_type: application/octet-stream