Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 117 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,59 @@
name: Build Specview Executables
name: Build and Release Specview

on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0
workflow_dispatch:
inputs:
version:
description: 'Version tag for the release (e.g. v0.2.0-test). A pre-release will be created with this name.'
required: true
default: 'v0.0.0-test'

permissions:
contents: write # needed to create GitHub releases

jobs:
build:
setup:
runs-on: ubuntu-22.04
outputs:
release_tag: ${{ steps.get-tag.outputs.release_tag }}
prerelease: ${{ steps.get-tag.outputs.prerelease }}
steps:
- name: Determine release tag
id: get-tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "release_tag=${{ inputs.version }}" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "release_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi

build-binary:
needs: [setup]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-latest, windows-latest] #, windows-11-arm]
include:
- os: ubuntu-22.04
platform: linux
binary_src: dist/specview
binary_dst_suffix: linux
binary_ext: ""
- os: macos-latest
platform: macos
binary_src: dist/specview
binary_dst_suffix: macos
binary_ext: ""
- os: windows-latest
platform: windows
binary_src: dist/specview.exe
binary_dst_suffix: windows
binary_ext: ".exe"

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -19,7 +62,7 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install uv (Unix)
if: runner.os != 'Windows'
run: |
Expand All @@ -36,9 +79,75 @@ jobs:
uv sync --group build --group dev
uv run poe build-pyinstaller

- name: Upload executable artifact
- name: Rename binary with version and platform
shell: bash
run: |
VERSION="${{ needs.setup.outputs.release_tag }}"
VERSION="${VERSION#v}" # strip leading 'v'
BINARY_NAME="specview-${VERSION}-${{ matrix.binary_dst_suffix }}${{ matrix.binary_ext }}"
mv "${{ matrix.binary_src }}" "dist/${BINARY_NAME}"
echo "BINARY_NAME=${BINARY_NAME}" >> $GITHUB_ENV

- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: specview-${{ matrix.platform }}
path: dist/${{ env.BINARY_NAME }}

build-wheel:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Build wheel
run: |
uv build

- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: specview-${{ runner.os }}
path: |
dist/*
name: specview-wheel
path: dist/*.whl

release:
needs: [setup, build-binary, build-wheel]
runs-on: ubuntu-22.04

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4.1.3
with:
path: release-assets
# merge-multiple flattens all artifacts into one directory; filenames are
# unique by design (platform suffix on binaries, package name on the wheel).
merge-multiple: true

- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
RELEASE_TAG="${{ needs.setup.outputs.release_tag }}"
PRERELEASE_FLAG=""
if [ "${{ needs.setup.outputs.prerelease }}" = "true" ]; then
PRERELEASE_FLAG="--prerelease"
fi
# Create the release; if it already exists (e.g. workflow re-run), upload
# the files to the existing release instead.
gh release create "${RELEASE_TAG}" \
--title "Release ${RELEASE_TAG}" \
--generate-notes \
${PRERELEASE_FLAG} \
release-assets/* \
|| gh release upload "${RELEASE_TAG}" release-assets/* --clobber
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.12"

Expand Down
Loading