Skip to content

version: v5.14.1

version: v5.14.1 #156

Workflow file for this run

name: yt_clipper
on:
push:
branches:
- release
- release/*
- test-ci
# Workflow env variables not yet available at job level
# See https://github.community/t/how-to-set-and-access-a-workflow-variable/17335/14
# Can work around to some degree using set-env
env:
NAME: yt_clipper
VERSION: '5.14.1'
jobs:
build:
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 4
matrix:
python-version: [3.8.x]
node-version: [12.x]
poetry-version: ['1.5.1']
os: [windows-latest, macos-latest]
include:
- os: windows-latest
shortos: win
ffmpeg_dl_name: ffmpeg-6.0-full_build-shared
ffmpeg_dl_prefix: 'https://www.gyan.dev/ffmpeg/builds/packages'
- os: macos-latest
shortos: macos
ffmpeg_dl_url: 'https://evermeet.cx/ffmpeg/ffmpeg-6.0.7z'
ffprobe_dl_url: 'https://evermeet.cx/ffmpeg/ffprobe-6.0.7z'
ffplay_dl_url: 'https://evermeet.cx/ffmpeg/ffplay-6.0.7z'
ffmpeg_info_url: 'https://evermeet.cx/ffmpeg/info/6.0'
steps:
- name: Set env
shell: bash
run: |
echo "FULL_NAME=${{env.NAME}}_${{matrix.shortos}}_${{env.VERSION}}" >> $GITHUB_ENV
echo "NOPLAT_NAME=${{env.NAME}}_${{env.VERSION}}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Set up dirs
shell: bash
run: |
mkdir -p ./artifact/py/${{env.FULL_NAME}}/{webms,bin,temp}/
mkdir -p ./bindeps
- name: Download ffmpeg dependency (windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
cd ./bindeps
curl -o ./ffmpeg.zip -L ${{ format('{0}/{1}.7z', matrix.ffmpeg_dl_prefix, matrix.ffmpeg_dl_name) }}
7z x ./ffmpeg.zip
mv ./${{matrix.ffmpeg_dl_name}} ffmpeg
./ffmpeg/bin/ffmpeg -version > version.txt
mv version.txt ffmpeg
ls -laR
- name: Download ffmpeg dependency (markup)
if: matrix.os == 'macos-latest'
shell: bash
run: |
cd ./bindeps
mkdir temp
cd temp
curl -o ./ffmpeg.7z -L ${{matrix.ffmpeg_dl_url}}
curl -o ./ffprobe.7z -L ${{matrix.ffprobe_dl_url}}
curl -o ./ffplay.7z -L ${{matrix.ffplay_dl_url}}
curl -o version.txt -L ${{matrix.ffmpeg_info_url}}
7z x ./ffmpeg.7z
7z x ./ffprobe.7z
7z x ./ffplay.7z
cd ..
mkdir -p ffmpeg/bin
mv temp/ffmpeg temp/ffprobe temp/ffplay ffmpeg/bin
chmod -v +x ffmpeg/bin/*
mv temp/version.txt ffmpeg
ls -laR
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Load cached node_modules
id: cached-node_modules
uses: actions/cache@v3
with:
path: node_modules
key: yarn-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile
- run: yarn run bundle:prod
- name: Install poetry
run: pipx install poetry
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install clipper python dependencies
run: |
poetry install --no-interaction --no-root
- name: Lint with pylint
run: |
npm run lint:py
- name: Run clipper tests
run: |
npm run test:py
- name: Generate executable
run: npm run build:py
- name: Copy artifacts
shell: bash
run: |
mv ./bindeps/ffmpeg/bin/* ./artifact/py/${{env.FULL_NAME}}/bin/
mv ./bindeps/ffmpeg/*.txt ./artifact/py/${{env.FULL_NAME}}/bin/
cp ./src/clipper/include/* ./artifact/py/${{env.FULL_NAME}}/
cp ./src/clipper/${{matrix.shortos}}_helpers/* ./artifact/py/${{env.FULL_NAME}}/
cp ./dist/py/yt_clipper* ./artifact/py/${{env.FULL_NAME}}/
- name: Print clipper install version (windows)
if: matrix.os == 'windows-latest'
run: |
./dist/py/yt_clipper.exe --version
- name: Print clipper install version (non-windows)
if: matrix.os != 'windows-latest'
run: |
./dist/py/yt_clipper --version
- name: Copy artifacts (markup)
if: matrix.os == 'macos-latest'
shell: bash
run: |
mkdir -p ./artifact/js/
cp ./dist/js/yt_clipper.js ./artifact/js/${{env.NOPLAT_NAME}}.js
- name: Zip artifacts on windows
if: matrix.os == 'windows-latest'
shell: powershell
run: |
Compress-Archive ./artifact/py/${{env.FULL_NAME}}/ ./artifact/py/${{env.FULL_NAME}}.zip
- name: Zip artifacts on non-windows systems
if: matrix.os != 'windows-latest'
run: |
cd ./artifact/py
zip -r ${{env.FULL_NAME}}.zip ./${{env.FULL_NAME}}/
- name: Upload clipper script installation artifact
uses: actions/upload-artifact@v2
with:
name: ${{env.FULL_NAME}}.zip
path: ./artifact/py/${{env.FULL_NAME}}.zip
- name: Upload markup script installation artifact
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v2
with:
name: ${{env.NOPLAT_NAME}}.js
path: ./artifact/js/${{env.NOPLAT_NAME}}.js
release:
needs: build
runs-on: macos-latest
steps:
- name: Set env
run: |
echo "DATE=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
echo "FULL_NAME=${{env.NAME}}_${{env.VERSION}}" >> $GITHUB_ENV
echo "FULL_NAME_WIN=${{env.NAME}}_win_${{env.VERSION}}" >> $GITHUB_ENV
echo "FULL_NAME_MAC=${{env.NAME}}_macos_${{env.VERSION}}" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: ${{env.FULL_NAME_WIN}}.zip
- uses: actions/download-artifact@v2
with:
name: ${{env.FULL_NAME_MAC}}.zip
- uses: actions/download-artifact@v2
with:
name: ${{env.FULL_NAME}}.js
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: v${{env.VERSION}}
release_name: ${{env.NAME}} v${{env.VERSION}} [${{env.DATE}}]
draft: true
prerelease: false
- name: Upload release asset (win)
id: upload-release-asset-win
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ${{env.FULL_NAME_WIN}}.zip
asset_name: ${{env.FULL_NAME_WIN}}.zip
asset_content_type: application/zip
- name: Upload release asset (mac)
id: upload-release-asset-mac
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ${{env.FULL_NAME_MAC}}.zip
asset_name: ${{env.FULL_NAME_MAC}}.zip
asset_content_type: application/zip
- name: Upload release asset (markup)
id: upload-release-asset-markup
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ${{env.FULL_NAME}}.js
asset_name: ${{env.FULL_NAME}}.js
asset_content_type: text/javascript