-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (95 loc) · 2.89 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
name: Release
on:
push:
branches:
- main
- rc
- beta
- alpha
permissions:
contents: write
jobs:
get-version:
uses: shiipou/github-actions/.github/workflows/get-version.yml@main
with:
prerelease-branches: "^(rc|beta|alpha)$"
build:
needs: get-version
if: ${{ needs.get-version.outputs.will-release }}
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
env:
VERSION: ${{ needs.get-version.outputs.version }}
strategy:
matrix: # Need to find what's the best target for `x86-x64-linux` and remove the others (gnu or musl)
include:
- target: aarch64-unknown-linux-musl
os: linux
arch: aarch64
runner: ubuntu-20.04
- target: x86_64-unknown-linux-musl
os: linux
arch: x86_64
runner: ubuntu-20.04
- target: x86_64-pc-windows-msvc
os: windows
arch: x86_64
runner: windows-2022
file_extension: '.exe'
- target: aarch64-pc-windows-msvc
os: windows
arch: aarch64
runner: windows-2022
file_extension: '.exe'
- target: x86_64-apple-darwin
os: macos
arch: x86_64
runner: macos-latest
- target: aarch64-apple-darwin
os: macos
arch: aarch64
runner: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Install cargo-edit
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-edit
- name: Set version
uses: actions-rs/cargo@v1
with:
command: set-version
args: ${{ env.VERSION }}
- name: Build target
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release -F cli -F permissive --target ${{ matrix.target }}
- name: Rename artifact to platform specific name
run: |
mv target/${{ matrix.target }}/release/dofigen${{ matrix.file_extension }} ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: dofigen-${{ matrix.os }}-${{ matrix.arch }}
path: ./dofigen-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.file_extension }}
release:
needs: [ get-version, build ]
if: ${{ needs.get-version.outputs.will-release }}
uses: shiipou/github-actions/.github/workflows/release.yml@main
with:
version: ${{ needs.get-version.outputs.version }}
changelogs: ${{ needs.get-version.outputs.changelogs }}
is-prerelease: ${{ needs.get-version.outputs.is-prerelease }}
download-artifacts: true
assets: artifacts/