Build and Release DEB and RPM #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release DEB and RPM | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Semantic version tags | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up CMake | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: '3.28' | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y dpkg-dev rpm libvlc-dev vlc libvlccore-dev build-essential | |
- name: Build project | |
run: | | |
mkdir build | |
cd build | |
cmake .. | |
make | |
- name: Build DEB package | |
run: | | |
mkdir -p build/debian/DEBIAN/ | |
cp debian/* build/debian/DEBIAN/ | |
mkdir -p build/debian/usr/lib/x86_64-linux-gnu/vlc/plugins/misc | |
cp lib/libxattrplaying_plugin.so build/debian/usr/lib/x86_64-linux-gnu/vlc/plugins/misc/ | |
cd build | |
dpkg-deb --build debian xattrplaying_plugin_${GITHUB_REF#refs/tags/}.deb | |
- name: Setup RPM package | |
run: | | |
mkdir -p build/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | |
cp spec/libxattrplaying_plugin.spec build/rpm/SPECS/ | |
cp lib/libxattrplaying_plugin.so build/rpm/BUILD/ | |
rpmbuild --define "_topdir $(pwd)/build/rpm" -bb build/rpm/SPECS/libxattrplaying_plugin.spec | |
- name: Determine tag name | |
id: tag_name | |
run: | | |
echo "::set-output name=tag_name::$(echo ${{ github.ref }} | cut -d '/' -f 3)" | |
echo "::set-output name=version::$(echo ${{ github.ref }} | cut -d '/' -f 3 | cut -d 'v' -f 2 )" | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ github.ref }} | |
name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload DEB package to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/xattrplaying_plugin_${{ steps.tag_name.outputs.tag_name }}.deb | |
asset_name: xattrplaying_plugin_${{ steps.tag_name.outputs.tag_name }}.deb | |
asset_content_type: application/vnd.debian.binary-package | |
- name: Upload RPM package to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/rpm/RPMS/x86_64/libxattrplaying_plugin-${{ steps.tag_name.outputs.version }}-1.x86_64.rpm | |
asset_name: libxattrplaying_plugin-${{ steps.tag_name.outputs.version }}-1.x86_64.rpm | |
asset_content_type: application/x-rpm |