Skip to content

Build and Release

Build and Release #7

Workflow file for this run

name: Build and Release
on:
workflow_dispatch:
inputs:
release_tag:
description: "Release tag (optional, defaults to current datetime)"
required: false
type: string
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact_name: FSAR-windows.exe
- os: ubuntu-latest
artifact_name: FSAR-linux
pyinstaller_args: --onefile
- os: macos-latest
artifact_name: FSAR-macos
pyinstaller_args: --onefile
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install pyinstaller
shell: bash
- name: Build executable with PyInstaller
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
echo "Building Windows executable with spec file..."
pyinstaller .github/FSAR-windows.spec
else
echo "Building ${{ matrix.os }} executable..."
pyinstaller ${{ matrix.pyinstaller_args }} --icon logo.ico --name ${{ matrix.artifact_name }} --hidden-import curses --hidden-import _curses FSAR.py
fi
echo "Build completed. Contents of dist directory:"
ls -la dist/
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
dist/${{ matrix.artifact_name }}*
retention-days: 1
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Generate release tag
id: tag
run: |
if [ -n "${{ github.event.inputs.release_tag }}" ]; then
echo "tag=${{ github.event.inputs.release_tag }}" >> $GITHUB_OUTPUT
else
echo "tag=release-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display artifact structure
run: |
ls -la artifacts/
find artifacts/ -type f
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.tag }}
release_name: FSAR Release ${{ steps.tag.outputs.tag }}
body: |
Automated release of FSAR built for multiple platforms.
**Included binaries:**
- Windows: FSAR-windows.exe
- Linux: FSAR-linux
- macOS: FSAR-macos
Built on: ${{ github.run_number }} - ${{ github.sha }}
draft: true
prerelease: false
- name: Upload Windows binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/FSAR-windows.exe/FSAR-windows.exe
asset_name: FSAR-windows.exe
asset_content_type: application/octet-stream
- name: Upload Linux binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/FSAR-linux/FSAR-linux
asset_name: FSAR-linux
asset_content_type: application/octet-stream
- name: Upload macOS binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/FSAR-macos/FSAR-macos
asset_name: FSAR-macos
asset_content_type: application/octet-stream