Skip to content

Refactor file paths for artifact uploads #13

Refactor file paths for artifact uploads

Refactor file paths for artifact uploads #13

Workflow file for this run

name: Build executable and Create draft release
# Build and release the simple_ytdl executable when a tag is pushed
# Executables will be built according to the values of the BUILD_WINDOWS, BUILD_LINUX, and BUILD_MACOS repository variables
# Set repo variable values in Settings > Secrets and variables > Actions > Variables > Repository variables
on:
push:
tags:
- v*
jobs:
# region Build Win exe
build-windows:
if: ${{ vars.BUILD_WINDOWS == 'true' }}
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python Packages
run: python scripts/install_reqs.py
- name: Build simple_ytdl.exe
run: python scripts/build.py -cs
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: simple_ytdl_windows
path: ./pyinstaller
# region Build Linux exe
build-linux:
if: ${{ vars.BUILD_LINUX == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python Packages
run: python scripts/install_reqs.py
- name: Build simple_ytdl
run: python scripts/build.py -cs
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: simple_ytdl_linux
path: ./pyinstaller
# region Build MacOS exe
build-macos:
if: ${{ vars.BUILD_MACOS == 'true' }}
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python Packages
run: python scripts/install_reqs.py
- name: Build simple_ytdl
run: python scripts/build.py -cs
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: simple_ytdl_macos
path: ./pyinstaller
# region Create a draft release
release:
# Wait for all build jobs to complete, as long as none of them failed then we will create the draft release
needs: [build-windows, build-linux, build-macos]
if: ${{ !failure() }}
runs-on: ubuntu-latest
steps:
- name: Download Windows executable
if: ${{ vars.BUILD_WINDOWS == 'true' }}
uses: actions/download-artifact@v4
with:
name: simple_ytdl_windows
- name: Download Linux executable
if: ${{ vars.BUILD_LINUX == 'true' }}
uses: actions/download-artifact@v4
with:
name: simple_ytdl_linux
- name: Download MacOS executable
if: ${{ vars.BUILD_MACOS == 'true' }}
uses: actions/download-artifact@v4
with:
name: simple_ytdl_macos
- name: Create a draft release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: true
prerelease: false
files: |
${{ vars.BUILD_WINDOWS == 'true' && 'dist/simple_ytdl_win32.exe' || '' }}
${{ vars.BUILD_LINUX == 'true' && 'dist/simple_ytdl_linux' || '' }}
${{ vars.BUILD_MACOS == 'true' && 'dist/simple_ytdl_macos' || '' }}