Skip to content

Commit

Permalink
tag
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeokjunejeon committed Dec 8, 2024
1 parent 011a00c commit 1a195fd
Showing 1 changed file with 32 additions and 23 deletions.
55 changes: 32 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,38 @@ name: Release
on:
workflow_dispatch:
inputs:
package-version:
type: string
description: set version to release
version:
description: '릴리스 버전 (예: 1.0.0)'
required: true
default: 0.0.0
type: string

env:
RELEASE_VERSION: ${{ github.event.inputs.version }}

jobs:
build-and-release:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl # Alpine Linux
- x86_64-unknown-linux-gnu # Ubuntu/Debian
- x86_64-unknown-linux-gnu # RPM (CentOS/RHEL/Fedora)
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:
Expand All @@ -37,7 +50,7 @@ jobs:
sudo apt-get install -y musl-tools
- name: Install RPM build tools
if: matrix.target == 'x86_64-unknown-linux-gnu' && matrix.packaging == 'rpm'
if: matrix.packaging == 'rpm'
run: |
sudo apt-get update
sudo apt-get install -y rpm
Expand All @@ -49,11 +62,11 @@ jobs:
args: --release --target ${{ matrix.target }}

- name: Create RPM spec file
if: matrix.target == 'x86_64-unknown-linux-gnu' && matrix.packaging == 'rpm'
if: matrix.packaging == 'rpm'
run: |
cat > mlperf-log-parser.spec << EOF
Name: mlperf-log-parser
Version: $(echo $GITHUB_REF | cut -d / -f 3 | sed 's/v//')
Version: ${{ env.RELEASE_VERSION }}
Release: 1%{?dist}
Summary: MLPerf Log Parser Tool
Expand All @@ -71,34 +84,30 @@ jobs:
%{_bindir}/mlperf-log-parser
%changelog
* $(date '+%a %b %d %Y') GitHub Action <[email protected]> - $(echo $GITHUB_REF | cut -d / -f 3 | sed 's/v//')-1
* $(date '+%a %b %d %Y') GitHub Action <[email protected]> - ${{ env.RELEASE_VERSION }}-1
- Automated RPM release
EOF
- name: Build RPM package
if: matrix.target == 'x86_64-unknown-linux-gnu' && matrix.packaging == 'rpm'
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-centos-x86_64.rpm
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
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]]; then
tar czf ../../../mlperf-log-parser-alpine-x86_64.tar.gz mlperf-log-parser
elif [[ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" && "${{ matrix.packaging }}" != "rpm" ]]; then
tar czf ../../../mlperf-log-parser-ubuntu-x86_64.tar.gz mlperf-log-parser
fi
tar czf ../../../mlperf-log-parser-${{ matrix.name }}-x86_64.tar.gz mlperf-log-parser
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: Release v${{ env.RELEASE_VERSION }}
tag_name: v${{ env.RELEASE_VERSION }}
files: |
mlperf-log-parser-alpine-x86_64.tar.gz
mlperf-log-parser-ubuntu-x86_64.tar.gz
mlperf-log-parser-centos-x86_64.rpm
mlperf-log-parser-*-x86_64.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 1a195fd

Please sign in to comment.