Skip to content

feat: add progress bars for fetching Pokemon data #14

feat: add progress bars for fetching Pokemon data

feat: add progress bars for fetching Pokemon data #14

Workflow file for this run

name: Build and Release Executables
on:
push:
tags:
- 'v*' # Trigger when pushing tags like v1.0.0
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
test:
uses: ./.github/workflows/test.yml # Reuse the test workflow
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: test # Only build if tests pass
strategy:
matrix:
include:
# Windows
- os: windows-latest
output_name: pokemon-card-generator-windows.exe
# macOS (Apple Silicon)
- os: macos-latest
output_name: pokemon-card-generator-macos-arm
# Linux
- os: ubuntu-latest
output_name: pokemon-card-generator-linux
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv (Windows)
if: runner.os == 'Windows'
run: pip install uv
- name: Install uv (Unix)
if: runner.os != 'Windows'
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install dependencies and build
run: |
uv sync
uv pip install pyinstaller
uv pip install -e .
uv run pyinstaller --onefile --name pokemon-card-generator main.py
- name: Rename output (Windows)
if: runner.os == 'Windows'
run: |
Move-Item -Path "dist\pokemon-card-generator.exe" -Destination "dist\${{ matrix.output_name }}"
- name: Rename output (Unix)
if: runner.os != 'Windows'
run: |
mv dist/pokemon-card-generator "dist/${{ matrix.output_name }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output_name }}
path: dist/${{ matrix.output_name }}
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: List artifacts
run: |
echo "Downloaded artifacts:"
ls -R artifacts/
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Generate changelog with git-cliff
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --current --strip all
env:
OUTPUT: CHANGELOG.md
- name: Prepare release body
id: release_body
run: |
cat > RELEASE_BODY.md << 'EOF'
## 📥 Downloads
| Platform | File |
|----------|------|
| 🪟 Windows | `pokemon-card-generator-windows.exe` |
| 🍎 macOS (Apple Silicon) | `pokemon-card-generator-macos-arm` |
| 🐧 Linux | `pokemon-card-generator-linux` |
## 📝 What's Changed
EOF
cat CHANGELOG.md >> RELEASE_BODY.md
cat >> RELEASE_BODY.md << 'EOF'
## 📖 Documentation
- **[README](https://github.com/${{ github.repository }}#readme)** - Installation and usage guide
- **[Contributing Guide](https://github.com/${{ github.repository }}/blob/master/CONTRIBUTING.md)** - For developers
---
**⚠️ Legal Notice**: Fan-made tool for personal use only. Not affiliated with Nintendo/The Pokemon Company.
EOF
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Pokemon Card Generator ${{ steps.get_version.outputs.VERSION }}
body_path: RELEASE_BODY.md
files: |
artifacts/**/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}