dtranslatebot/.github/workflows/linux-rpm.yml
2024-03-22 02:37:29 +01:00

45 lines
1.5 KiB
YAML

name: Linux
on: push
jobs:
Release:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: Enterprise Linux 7
version: el7
- name: Enterprise Linux 8
version: el8
- name: Enterprise Linux 9
version: el9
- name: openSUSE Leap 15.5
version: lp155
steps:
- name: Cloning
uses: actions/checkout@v4
- name: Preparing
run: mkdir -m 777 ${{github.workspace}}/rpms
- name: Build RPM
uses: addnab/docker-run-action@v3
with:
image: docker.io/syping/dtranslatebot-build:${{matrix.version}}
options: -v ${{github.workspace}}:/home/rpmbuild/dtranslatebot -v ${{github.workspace}}/rpms:/home/rpmbuild/rpmbuild/RPMS
run: |
VERSION=$(cat dtranslatebot/CMakeLists.txt | grep -oP "project\(dtranslatebot VERSION \K(\S*)(?= LANGUAGES CXX\))")
mkdir -p dtranslatebot-$VERSION
shopt -s extglob
cp -R dtranslatebot/!(rpms|rpmsrc) \
dtranslatebot-$VERSION
tar cfz dtranslatebot-$VERSION.tar.gz dtranslatebot-$VERSION
cp dtranslatebot-$VERSION.tar.gz \
dtranslatebot/rpmsrc/!(*.spec) \
rpmbuild/SOURCES
cp dtranslatebot/rpmsrc/*.spec \
rpmbuild/SPECS
rpmbuild -ba rpmbuild/SPECS/dtranslatebot.spec
- name: Upload
uses: actions/upload-artifact@v4
with:
name: ${{matrix.name}}
path: |
${{github.workspace}}/rpms/x86_64/*.rpm