Skip to content

(wip) Working on setting release artifact names. #44

(wip) Working on setting release artifact names.

(wip) Working on setting release artifact names. #44

Workflow file for this run

name: Main
on:
- push
- pull_request
jobs:
main:
strategy:
matrix:
python-version: ['3.11']
os: ['ubuntu-22.04', 'macos-12', 'windows-2022']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Variables
id: vars
shell: bash
run: |
sha_short=$(git rev-parse --short HEAD)
base_version=$(grep version pyproject.toml | sed 's/^.*"\(.*\)"$/\1/')
echo "sha_short=${sha_short}" >> $GITHUB_OUTPUT
echo "base_version=${base_version}" >> $GITHUB_OUTPUT
echo "full_version=${base_version}-${sha_short}" >> $GITHUB_OUTPUT
echo "bin_version=$(echo "shark-clipper-${{ runner.os }}-${{ runner.arch }}-latest" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Write Version File
shell: bash
run: |
echo "${{ steps.vars.outputs.full_version }}" > VERSION.txt
# TEST
- name: Test List
shell: bash
run: |
echo "SHA: ${{ steps.vars.outputs.sha_short }}"
echo "Base Version: ${{ steps.vars.outputs.base_version }}"
echo "Full Version: ${{ steps.vars.outputs.full_version }}"
echo "Bin Version: ${{ steps.vars.outputs.bin_version }}"
cat VERSION.txt
- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python Dependencies
uses: actions/cache@v4
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-os:${{ matrix.os }}-python:${{ matrix.python-version }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}
- name: Install Python Dependencies
shell: bash
run: pip3 install -r requirements.txt -r requirements-dev.txt
- name: Check Python Version Compatibility
shell: bash
run: vermin --no-tips --no-parse-comments --target=3.8- --violations sharkclipper
# Create a release for this OS (but only on a single version of Python).
# See: https://github.com/Nuitka/Nuitka?tab=readme-ov-file#use-case-7--building-with-github-workflows
- name: Fetch FFmpeg
if: matrix.python-version == '3.11'
shell: bash
run: ./scripts/fetch-ffmpeg.py
- name: Build ${{ runner.os }} Release Executable with Nuitka
if: matrix.python-version == '3.11'
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: sharkclipper/cli/server.py
standalone: true
onefile: true
output-file: 'shark-clipper-${{ steps.vars.outputs.bin_version }}.bin'
include-data-dir: |
./static=static
include-data-files: |
./pyproject.toml=./
./VERSION.txt=./
./ffmpeg=./
./ffprobe=./
include-package: |
sharkclipper
- name: Set Windows Name
if: (matrix.python-version == '3.11') && (runner.os == 'Windows')
shell: bash
run: |
mv "build/shark-clipper-${{ steps.vars.outputs.bin_version }}.bin.exe" "build/shark-clipper-${{ steps.vars.outputs.bin_version }}.exe"
- name: Upload Artifacts
if: matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: 'shark-clipper-${{ steps.vars.outputs.bin_version }}'
compression-level: 0
path: build/shark-clipper-*
- name: Release Latest
if: matrix.python-version == '3.11'
uses: softprops/action-gh-release@v2
with:
tag_name: latest-release
make_latest: true
files: build/shark-clipper-*
- name: Cleanup
if: matrix.python-version == '3.11'
shell: bash
run: rm -rf ffmpeg ffprobe build