-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (95 loc) · 3.28 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
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Release
on:
workflow_dispatch:
inputs:
version:
description: '릴리스 버전 (예: 1.0.0)'
required: true
type: string
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
jobs:
build-and-release:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
packaging: tar
name: alpine
- target: x86_64-unknown-linux-gnu
packaging: tar
name: ubuntu
- target: x86_64-unknown-linux-gnu
packaging: rpm
name: centos
steps:
- uses: actions/checkout@v3
- name: Create Release Tag
run: |
git tag v${{ env.RELEASE_VERSION }}
git push origin v${{ env.RELEASE_VERSION }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install musl-tools (for Alpine)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Install RPM build tools
if: matrix.packaging == 'rpm'
run: |
sudo apt-get update
sudo apt-get install -y rpm
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Create RPM spec file
if: matrix.packaging == 'rpm'
run: |
cat > mlperf-log-parser.spec << EOF
Name: mlperf-log-parser
Version: ${{ env.RELEASE_VERSION }}
Release: 1%{?dist}
Summary: MLPerf Log Parser Tool
License: MIT
URL: https://github.com/$GITHUB_REPOSITORY
%description
A tool for parsing MLPerf log files
%install
mkdir -p %{buildroot}%{_bindir}
install -m 755 target/x86_64-unknown-linux-gnu/release/mlperf-log-parser %{buildroot}%{_bindir}/mlperf-log-parser
%files
%{_bindir}/mlperf-log-parser
%changelog
* $(date '+%a %b %d %Y') GitHub Action <[email protected]> - ${{ env.RELEASE_VERSION }}-1
- Automated RPM release
EOF
- name: Build RPM package
if: matrix.packaging == 'rpm'
run: |
mkdir -p ~/rpmbuild/{SPECS,SOURCES,BUILD,RPMS,SRPMS}
cp mlperf-log-parser.spec ~/rpmbuild/SPECS/
rpmbuild -bb ~/rpmbuild/SPECS/mlperf-log-parser.spec
cp ~/rpmbuild/RPMS/x86_64/*.rpm ./mlperf-log-parser-${{ matrix.name }}-x86_64.rpm
- name: Package Binary
if: matrix.packaging == 'tar'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../mlperf-log-parser-${{ matrix.name }}-x86_64.tar.gz mlperf-log-parser
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release v${{ env.RELEASE_VERSION }}
tag_name: v${{ env.RELEASE_VERSION }}
files: |
mlperf-log-parser-*-x86_64.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}