Skip to content

Creating Executable of project #8

Creating Executable of project

Creating Executable of project #8

Workflow file for this run

name: Build and Create Release
on:
push:
branches:
- main
pull_request: null
# tags:
# - 'v*.*.*'
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies (Bash)
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install yahooquery
pip install tkmacosx
shell: bash
- name: Install dependencies (PowerShell)
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
pip install yahooquery
pip install tkmacosx
shell: pwsh
- name: Create executable (macOS)
if: matrix.os == 'macos-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets:assets" user_interface.py
hdiutil create -volname UserInterface -srcfolder dist/ -ov -format UDZO dist/user_interface.dmg
shell: bash
- name: Create executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets:assets" user_interface.py
shell: bash
- name: Create executable (Windows)
if: matrix.os == 'windows-latest'
run: |
pyinstaller --onefile --noconsole --add-data "assets;assets" user_interface.py
shell: pwsh
- name: Upload artifacts (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-macOS
path: dist/user_interface.dmg
- name: Upload artifacts (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-Linux
path: dist/user_interface
- name: Upload artifacts (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: user_interface-Windows
path: dist/user_interface.exe
release:
needs: build
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: user_interface-macOS
path: ./artifacts/macos
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: user_interface-Linux
path: ./artifacts/linux
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: user_interface-Windows
path: ./artifacts/windows
- name: Install Ruby
run: sudo apt-get install ruby-full
- name: Install GitHub Changelog Generator
run: sudo gem install github_changelog_generator
- name: Generate CHANGELOG
run: |
github_changelog_generator -u cortisiko -p stockAnalysis --token ${{ secrets.GITHUB_TOKEN }} \
--enhancement-label "New Features πŸŽ‰" \
--add-sections "[\"Infra Changes πŸ› \",\"Tests Changes πŸ€–\",\"Bug Fixes πŸ›\"]" \
--label-section-map "{\"Infra Changes πŸ› \": [\"Infra\", \"infrastructure\"], \"Tests Changes πŸ€–\": [\"Tests\", \"tests\"], \"Bug Fixes πŸ›\": [\"bug\", \"bug-fix\"]}" \
--exclude-labels "dependencies"
env:
CHANGELOG_PATH: ./CHANGELOG.md
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: 0.0.1
# tag_name: ${{ github.ref }}
release_name: Release 0.0.1
body_path: CHANGELOG.md
draft: false
prerelease: false
- name: Upload Release Asset (macOS)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/macos/user_interface.dmg
asset_name: user_interface.dmg
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/linux/user_interface
asset_name: user_interface
asset_content_type: application/octet-stream
- name: Upload Release Asset (Windows)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows/user_interface.exe
asset_name: user_interface-Windows.exe
asset_content_type: application/octet-stream