Skip to content

👷 chore(ci): improve release workflow file checks #10

👷 chore(ci): improve release workflow file checks

👷 chore(ci): improve release workflow file checks #10

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-2022, macos-latest]
include:
- os: ubuntu-latest
platform: linux
binary_name: smart-commit-linux
- os: windows-2022
platform: windows
binary_name: smart-commit-windows.exe
- os: macos-latest
platform: macos
binary_name: smart-commit-macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build binary (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
echo "=== Building Windows binary ==="
pyinstaller `
--onefile `
--name smart-commit `
--add-data "smart_commit/config.yml;smart_commit" `
--hidden-import google.generativeai `
--hidden-import pydantic `
--hidden-import yaml `
--hidden-import click `
--hidden-import dotenv `
smart_commit/main.py
echo "=== Build completed, checking dist directory ==="
Get-ChildItem dist/
echo "=== Checking for smart-commit.exe ==="
if (Test-Path "dist/smart-commit.exe") { echo "✅ smart-commit.exe found" } else { echo "❌ smart-commit.exe missing" }
- name: Build binary (Unix)
if: matrix.platform != 'windows'
shell: bash
run: |
echo "=== Building Unix binary ==="
pyinstaller \
--onefile \
--name smart-commit \
--add-data "smart_commit/config.yml:smart_commit" \
--hidden-import google.generativeai \
--hidden-import pydantic \
--hidden-import yaml \
--hidden-import click \
--hidden-import dotenv \
smart_commit/main.py
echo "=== Build completed, checking dist directory ==="
ls -la dist/
echo "=== Checking for smart-commit ==="
test -f dist/smart-commit && echo "✅ smart-commit found" || echo "❌ smart-commit missing"
- name: Rename binary (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
echo "=== Renaming Windows binary ==="
echo "Source: dist\smart-commit.exe"
echo "Target: dist\${{ matrix.binary_name }}"
Move-Item dist\smart-commit.exe dist\${{ matrix.binary_name }}
echo "=== After rename, checking dist directory ==="
Get-ChildItem dist/
echo "=== Verifying renamed file exists ==="
if (Test-Path "dist/${{ matrix.binary_name }}") { echo "✅ ${{ matrix.binary_name }} found" } else { echo "❌ ${{ matrix.binary_name }} missing" }
- name: Rename binary (Unix)
if: matrix.platform != 'windows'
shell: bash
run: |
echo "=== Renaming Unix binary ==="
echo "Source: dist/smart-commit"
echo "Target: dist/${{ matrix.binary_name }}"
mv dist/smart-commit dist/${{ matrix.binary_name }}
echo "=== After rename, checking dist directory ==="
ls -la dist/
echo "=== Verifying renamed file exists ==="
test -f dist/${{ matrix.binary_name }} && echo "✅ ${{ matrix.binary_name }} found" || echo "❌ ${{ matrix.binary_name }} missing"
- name: Check binary before upload (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
echo "=== Preparing to upload binary ==="
echo "Binary name: ${{ matrix.binary_name }}"
echo "Path: dist/${{ matrix.binary_name }}"
echo "=== Checking if file exists ==="
if (Test-Path "dist/${{ matrix.binary_name }}") { echo "✅ File exists" } else { echo "❌ File missing" }
echo "=== File size ==="
if (Test-Path "dist/${{ matrix.binary_name }}") { Get-ChildItem "dist/${{ matrix.binary_name }}" | Select-Object Name, Length } else { echo "File not found" }
- name: Check binary before upload (Unix)
if: matrix.platform != 'windows'
shell: bash
run: |
echo "=== Preparing to upload binary ==="
echo "Binary name: ${{ matrix.binary_name }}"
echo "Path: dist/${{ matrix.binary_name }}"
echo "=== Checking if file exists ==="
test -f dist/${{ matrix.binary_name }} && echo "✅ File exists" || echo "❌ File missing"
echo "=== File size ==="
ls -lh dist/${{ matrix.binary_name }} || echo "File not found"
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary_name }}
path: dist/${{ matrix.binary_name }}
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: List downloaded files
run: |
find . -name "smart-commit*" -type f
ls -la
echo "=== Directory structure ==="
find . -type d
echo "=== All files ==="
find . -type f
- name: Copy files to root
run: |
echo "=== Finding all smart-commit files ==="
find . -name "smart-commit*" -type f
echo "=== Copying files to root ==="
find . -name "smart-commit*" -type f -exec cp {} . \;
echo "=== Files in root after copy ==="
ls -la
echo "=== Verifying files exist ==="
test -f smart-commit-linux && echo "✅ smart-commit-linux found" || echo "❌ smart-commit-linux missing"
test -f smart-commit-windows.exe && echo "✅ smart-commit-windows.exe found" || echo "❌ smart-commit-windows.exe missing"
test -f smart-commit-macos && echo "✅ smart-commit-macos found" || echo "❌ smart-commit-macos missing"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
smart-commit-linux
smart-commit-windows.exe
smart-commit-macos
generate_release_notes: true
draft: false
prerelease: false
token: ${{ secrets.GH_PAT }}