-
Notifications
You must be signed in to change notification settings - Fork 13
100 lines (98 loc) · 3.54 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
99
100
# A reusable workflow for creating cross-platform release binaries/libraries
on:
workflow_call:
inputs:
version:
required: true
type: string
uploadRelease:
required: false
default: false
type: boolean
jobs:
build-for-release:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
os: [linux-gnu, macos, windows]
architecture: [x86_64, aarch64]
include:
- os: wasm
steps:
- uses: actions/checkout@v2
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.11.0
- name: Get output paths
uses: kanga333/variable-mapper@master
id: map
with:
key: "${{ matrix.os }}"
map: |
{
"linux-gnu": {
"libExt": "so",
"libName": "libfastfec",
"exeExt": ""
},
"mac": {
"libExt": "dylib",
"libName": "libfastfec",
"exeExt": ""
},
"windows": {
"libExt": "dll",
"libName": "fastfec",
"exeExt": ".exe"
},
"wasm": {
"libExt": "wasm",
"libName": "fastfec",
"exeExt": ""
}
}
export_to: output
- name: Build target
if: matrix.os != 'wasm'
run: zig build -Dtarget=${{ matrix.architecture }}-${{ matrix.os }}
- name: Build target (wasm)
if: matrix.os == 'wasm'
run: zig build -Dwasm
- name: Zip output executable
if: matrix.os != 'wasm'
run: zip -j fastfec-${{ matrix.os }}-${{ matrix.architecture }}-${{ inputs.version }}.zip zig-out/bin/fastfec${{ steps.map.outputs.exeExt }}
- name: Move output library
if: matrix.os != 'wasm'
run: mv zig-out/lib/${{ steps.map.outputs.libName }}.${{ steps.map.outputs.libExt }} libfastfec-${{ matrix.os }}-${{ matrix.architecture }}-${{ inputs.version }}.${{ steps.map.outputs.libExt }}
- name: Move output library (wasm)
if: matrix.os == 'wasm'
run: mv zig-out/lib/${{ steps.map.outputs.libName }}.${{ steps.map.outputs.libExt }} libfastfec-${{ inputs.version }}.${{ steps.map.outputs.libExt }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: matrix.os != 'wasm'
with:
path: |
fastfec-${{ matrix.os }}-${{ matrix.architecture }}-${{ inputs.version }}.zip
libfastfec-${{ matrix.os }}-${{ matrix.architecture }}-${{ inputs.version }}.${{ steps.map.outputs.libExt }}
- name: Upload artifacts (wasm)
uses: actions/upload-artifact@v2
if: matrix.os == 'wasm'
with:
path: |
libfastfec-${{ inputs.version }}.${{ steps.map.outputs.libExt }}
- name: GitHub release
uses: softprops/action-gh-release@v1
if: inputs.uploadRelease && matrix.os != 'wasm'
with:
tag_name: ${{ inputs.version }}
files: |
fastfec-${{ matrix.os }}-${{ matrix.architecture }}-${{ inputs.version }}.zip
libfastfec-${{ matrix.os }}-${{ matrix.architecture }}-${{ inputs.version }}.${{ steps.map.outputs.libExt }}
- name: GitHub release (wasm)
uses: softprops/action-gh-release@v1
if: inputs.uploadRelease && matrix.os == 'wasm'
with:
tag_name: ${{ inputs.version }}
files: |
libfastfec-${{ inputs.version }}.${{ steps.map.outputs.libExt }}