-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (76 loc) · 2.1 KB
/
release.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
name: Build & release
on:
push:
tags:
- "v*.*.*"
env:
BIN: orangutan-server
jobs:
setup:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Get current tag
id: tag
uses: devops-actions/[email protected]
with:
strip_v: true
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Verify versions
run: rustc --version && rustup --version && cargo --version
- name: Cache build context
id: cache-cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo
build:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
# TODO: Centralize this data
target: [x86_64-unknown-linux-gnu]
env:
tag: ${{ needs.setup.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add Rust target ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: Build for ${{ matrix.target }}
working-directory: src/orangutan
run: cargo build --release --bin $BIN --target ${{ matrix.target }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: $BIN-$tag-${{ matrix.target }}
path: src/orangutan/target/${{ matrix.target }}/release/$BIN
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: [setup, build]
env:
tag: ${{ needs.setup.outputs.tag }}
artifacts: $GITHUB_WORKSPACE/artifacts
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: $artifacts
- name: Release new version
uses: softprops/action-gh-release@v1
with:
name: $tag
body: "⚠️ Changelog not yet provided."
files: $artifacts/*