Skip to content

refactor: rename Downloader to RutubeDownloader #51

refactor: rename Downloader to RutubeDownloader

refactor: rename Downloader to RutubeDownloader #51

Workflow file for this run

name: Release Build
# Add explicit permissions for the entire workflow
permissions:
contents: write
discussions: write
packages: write
on:
push:
branches:
- main
tags:
- "v*"
jobs:
build:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v4
- name: Set up Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version-file: 'pyproject.toml'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
version: 2.0.0
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --extras dev
#----------------------------------------------
# Build executable
#----------------------------------------------
- name: Build with PyInstaller
run: poetry run pyinstaller ./async_rutube_downloader/run_ui.py --path ./async_rutube_downloader/ --clean --onefile --noconsole --add-data "locales:locales"
- name: Rename binary for Windows
if: matrix.os == 'windows-latest'
run: mv dist/run_ui.exe dist/rutube_downloader.exe
- name: Rename binary for Unix
if: matrix.os == 'ubuntu-latest'
run: mv dist/run_ui dist/rutube_downloader
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: dist/rutube_downloader*
retention-days: 1
#----------------------------------------------
# Release builded executable
#----------------------------------------------
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
binaries-*/rutube_downloader*
draft: false
prerelease: false
generate_release_notes: true
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#----------------------------------------------
# Publish library on PyPi
#----------------------------------------------
publish:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v2.1
with:
pypi_token: ${{ secrets.POETRY_PYPI_TOKEN_ASYNC_RUTUBE_DOWNLOADER }}
python_version: "3.12"