Skip to content

Release

Release #6

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: '릴리스 버전 (예: 1.0.0)'
required: true
type: string
default: '4.1.0'
branch:
description: '릴리스 브랜치 이름 (예: release-1.0.0)'
required: true
type: string
default: 'main'
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}
jobs:
check-out-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
build-and-package:
needs: check-out-branch
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
with:
ref: ${{ github.event.inputs.branch }}
- 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: |
BINARY_PATH="$(pwd)/target/x86_64-unknown-linux-gnu/release/mlperf-log-parser"
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 ${BINARY_PATH} %{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 --define "_topdir $HOME/rpmbuild" --define "_builddir $(pwd)"
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: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts-${{ matrix.name }}
path: mlperf-log-parser-*-x86_64.*
retention-days: 1
create-release:
needs: build-and-package
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Move artifacts to root
run: |
find artifacts -type f -name "mlperf-log-parser-*-x86_64.*" -exec mv {} . \;
- 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 }}