-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (73 loc) · 2.36 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
name: Release
permissions:
contents: write
on:
push:
tags:
- v*
jobs:
build:
name: Release binary
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
glibc: 2.17
extension: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
glibc: 2.17
extension: ""
- os: macos-latest
target: x86_64-apple-darwin
glibc: -1
extension: ""
- os: macos-latest
target: aarch64-apple-darwin
glibc: -1
extension: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
glibc: -1
extension: .exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
# Rustのpackage名を取得して環境変数に入れておく。(後のステップで使用)
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
# zigをインストール
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
# rustをインストール
- name: Install Rust toolchain
uses: moonrepo/setup-rust@v1
with:
targets: ${{ matrix.target }}
bins: cargo-zigbuild
# ビルド
- name: Build with glibc version
if: matrix.glibc != -1
run: |
cargo zigbuild --release --target ${{ matrix.target }}.${{ matrix.glibc }}
- name: Build without glibc version
if: matrix.glibc == -1
run: |
cargo build --release --target ${{ matrix.target }}
# ビルド済みバイナリをリネーム
- name: Rename artifacts
shell: bash
run: |
mv target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}{,-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.extension }}}
# ビルド済みバイナリをReleasesに配置
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.extension }}