Skip to content

Build

Build #65

Workflow file for this run

name: Build
on:
workflow_dispatch:
schedule:
- cron: "30 1 1,15 * *"
push:
tags:
- "v*.*.*"
paths:
- '.github/workflows/**'
- 'templates/**'
- 'main.py'
- 'data/**'
- 'helpers/**'
- 'config.ini'
- 'requirements.txt'
- 'images/logo.ico'
branches:
- main
defaults:
run:
shell: bash
jobs:
build:
name: Build release binaries
strategy:
fail-fast: false
matrix:
os:
- macos
- ubuntu
- windows
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip pyinstaller
pip install -r requirements.txt
- name: Release Versioning
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "__version__='${{github.ref_name}}'" > _version.py
- name: Nightly Versioning
if: true && !startsWith(github.ref, 'refs/tags/')
run: |
echo "__version__='nightly-${{github.sha}}'" > _version.py
- name: Build with pyinstaller
if: true && !startsWith(github.ref, 'refs/tags/')
run: pyinstaller --icon=images/logo.ico --onefile --distpath dist/twitchcollabnetwork/${{ matrix.os }}-${{github.ref_name}}/ --collect-data pyvis --name=twitchcollabnetwork-nightly main.py
- name: Release Build with pyinstaller
if: startsWith(github.ref, 'refs/tags/')
run: pyinstaller --icon=images/logo.ico --onefile --distpath dist/twitchcollabnetwork/${{ matrix.os }}-${{github.ref_name}}/ --collect-data pyvis --name=twitchcollabnetwork main.py
- name: Copy Resources
run: |
mkdir dist/twitchcollabnetwork/${{ matrix.os }}-${{github.ref_name}}/templates
mkdir dist/twitchcollabnetwork/${{ matrix.os }}-${{github.ref_name}}/updater
cp templates/* dist/twitchcollabnetwork/${{ matrix.os }}-${{github.ref_name}}/templates/
cp updater/* dist/twitchcollabnetwork/${{ matrix.os }}-${{github.ref_name}}/updater/
- name: Copy Config
run: cp config.ini dist/twitchcollabnetwork/${{ matrix.os }}-${{github.ref_name}}/config.ini
- name: Deploy Artifacts
uses: actions/upload-artifact@v4
if: true && !startsWith(github.ref, 'refs/tags/')
with:
name: twitchcollabnetwork-${{matrix.os}}-latest
path: dist/twitchcollabnetwork/${{matrix.os}}-${{github.ref_name}}/
if-no-files-found: error
retention-days: 20
- name: Release Rename
if: startsWith(github.ref, 'refs/tags/') && !startsWith(matrix.os, 'windows')
run: |
mkdir twitchcollabnetwork-${{github.ref_name}}
mv dist/twitchcollabnetwork/${{matrix.os}}-${{github.ref_name}}/* twitchcollabnetwork-${{github.ref_name}}/
zip -r twitchcollabnetwork-${{matrix.os}}-${{github.ref_name}}.zip twitchcollabnetwork-${{github.ref_name}}
- name: Release Rename - Windows
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
run: |
mkdir twitchcollabnetwork-${{github.ref_name}}
mv dist/twitchcollabnetwork/${{matrix.os}}-${{github.ref_name}}/* twitchcollabnetwork-${{github.ref_name}}/
7z a twitchcollabnetwork-${{matrix.os}}-${{github.ref_name}}.zip twitchcollabnetwork-${{github.ref_name}}
- name: Release Artifacts
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.TCN_GITHUB_TOKEN }}
files: twitchcollabnetwork-${{matrix.os}}-${{github.ref_name}}.zip