Attempt again #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release gptree CLI | |
on: | |
push: | |
tags: | |
- 'v*' # Trigger on version tags like v1.0.0 | |
workflow_dispatch: # Allow manual triggering | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
# Checkout code | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pyinstaller pathspec pyperclip | |
# Build binary with PyInstaller | |
- name: Build executable with PyInstaller | |
run: | | |
pyinstaller --onefile --name gptree cli_tool_gptree/main.py | |
# Rename binaries for platform-specific names | |
- name: Rename binaries for upload | |
shell: bash # Use Bash explicitly | |
run: | | |
if [ "${{ matrix.os }}" = "macos-latest" ]; then | |
mv dist/gptree dist/gptree-macos | |
elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then | |
mv dist/gptree dist/gptree-ubuntu | |
elif [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv dist/gptree.exe dist/gptree-windows.exe | |
fi | |
# Upload binary as artifact | |
- name: Upload binary as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gptree-${{ matrix.os }} | |
path: | | |
dist/gptree-macos | |
dist/gptree-ubuntu | |
dist/gptree-windows.exe | |
release: | |
name: Create Release | |
needs: build # Waits for the build job to complete | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Grants permission to create a release and upload files | |
steps: | |
# Checkout repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Download all artifacts from the build job | |
- name: Download all binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
# List downloaded files for debugging | |
- name: List downloaded binaries | |
run: ls -R artifacts | |
# Create GitHub Release and upload binaries | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: artifacts/**/* # Match all files recursively in artifacts/ | |
body: "Release of gptree CLI tool.\n\nDownload the appropriate binary for your operating system." | |
tag_name: ${{ github.ref_name }} | |
name: 'GPTree Release ${{ github.ref_name }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |