Build and Release DEB #5
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 | |
on: | |
workflow_dispatch: | |
jobs: | |
build-deb: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libbsd-dev libcjson-dev libcurl4-openssl-dev | |
- name: Build DEB | |
run: | | |
make deb | |
- name: Upload DEB artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: deb-package | |
path: deb/*.deb | |
create-release: | |
needs: build-deb | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download DEB artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: deb-package | |
path: . | |
- name: Find the DEB filename and extract version | |
id: find_deb | |
run: | | |
DEB_FILE=$(ls *.deb) | |
echo "deb_file=$DEB_FILE" >> $GITHUB_OUTPUT | |
VERSION=$(echo "$DEB_FILE" | sed -E 's/^.*_([0-9.]+)_.*/\1/') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create or Update GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.find_deb.outputs.version }} | |
release_name: "cmyflix v${{ steps.find_deb.outputs.version }}" | |
draft: true | |
prerelease: false | |
- name: Upload DEB 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: ${{ steps.find_deb.outputs.deb_file }} | |
asset_name: ${{ steps.find_deb.outputs.deb_file }} | |
asset_content_type: "application/vnd.debian.binary-package" |