Skip to content

Rework twitch auth to use only user (#13) #26

Rework twitch auth to use only user (#13)

Rework twitch auth to use only user (#13) #26

Workflow file for this run

name: Build
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
tags:
- "v*.*.*"
paths:
- '.github/workflows/**'
- 'templates/**'
- 'src/**'
- 'requirements.txt'
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.12'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip pyinstaller
pip install -r requirements.txt
- name: Setup Env Vars
run: |
echo "REF_NAME=${GITHUB_REF_NAME//\//_}" >> $GITHUB_ENV
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
- name: Release Versioning
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "__version__='${{env.REF_NAME}}'" > src/_version.py
- name: Nightly Versioning
if: true && !startsWith(github.ref, 'refs/tags/')
run: |
echo "__version__='nightly-${{github.sha}}'" > src/_version.py
- name: Build with pyinstaller
if: true && !startsWith(github.ref, 'refs/tags/')
# --noconsole # TODO: update code to log to file if frozen, impl rolling logs in local directory
run: pyinstaller --icon=images/logo.ico --onefile --collect-binaries python312.dll --hidden-import=aiosqlite --hidden-import=pyttsx4.drivers --hidden-import=pyttsx4.drivers.sapi5 --distpath dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/ --name=twitchchatdnd-nightly src/main.py
- name: Release Build with pyinstaller
if: startsWith(github.ref, 'refs/tags/')
# --noconsole
run: pyinstaller --icon=images/logo.ico --onefile --collect-binaries python312.dll --hidden-import=aiosqlite --hidden-import=pyttsx4.drivers --hidden-import=pyttsx4.drivers.sapi5 --distpath dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/ --name=twitchchatdnd src/main.py
- name: Copy Resources
run: |
mkdir dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/resources
mkdir dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/resources/images
mkdir dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/resources/server
mkdir dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/resources/server/static
mv images/* dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/resources/images
mv src/server/static/* dist/twitchchatdnd/${{ matrix.os }}-${{env.REF_NAME}}/resources/server/static
- name: Deploy Artifacts
uses: actions/upload-artifact@v4
if: true && !startsWith(github.ref, 'refs/tags/')
with:
name: twitchchatdnd-${{matrix.os}}-latest
path: dist/twitchchatdnd/${{matrix.os}}-${{env.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 twitchchatdnd-${{env.REF_NAME}}
mv dist/twitchchatdnd/${{matrix.os}}-${{env.REF_NAME}}/* twitchchatdnd-${{env.REF_NAME}}/
zip -r twitchchatdnd-${{matrix.os}}-${{env.REF_NAME}}.zip twitchchatdnd-${{env.REF_NAME}}
- name: Release Rename - Windows
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
run: |
mkdir twitchchatdnd-${{env.REF_NAME}}
mv dist/twitchchatdnd/${{matrix.os}}-${{env.REF_NAME}}/* twitchchatdnd-${{env.REF_NAME}}/
7z a twitchchatdnd-${{matrix.os}}-${{env.REF_NAME}}.zip twitchchatdnd-${{env.REF_NAME}}
- name: Release Artifacts
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.TCDND_GITHUB_TOKEN }}
files: twitchchatdnd-${{matrix.os}}-${{env.REF_NAME}}.zip
- name: Nightly Release Rename
if: true && !startsWith(github.ref, 'refs/tags/') && !startsWith(matrix.os, 'windows')
run: |
mkdir twitchchatdnd-${{env.REF_NAME}}
mv dist/twitchchatdnd/${{matrix.os}}-${{env.REF_NAME}}/* twitchchatdnd-${{env.REF_NAME}}/
zip -r twitchchatdnd-${{matrix.os}}-${{env.REF_NAME}}.zip twitchchatdnd-${{env.REF_NAME}}
- name: Nightly Rename - Windows
if: true && !startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
run: |
mkdir twitchchatdnd-${{env.REF_NAME}}
mv dist/twitchchatdnd/${{matrix.os}}-${{env.REF_NAME}}/* twitchchatdnd-${{env.REF_NAME}}/
7z a twitchchatdnd-${{matrix.os}}-${{env.REF_NAME}}.zip twitchchatdnd-${{env.REF_NAME}}
- name: Release nightly
uses: softprops/action-gh-release@v2
if: true && startsWith(github.ref_name, 'main')
with:
token: ${{ secrets.TCDND_GITHUB_TOKEN }}
prerelease: true
name: nightly
tag_name: nightly
files: twitchchatdnd-${{matrix.os}}-${{env.REF_NAME}}.zip
fail_on_unmatched_files: true