Skip to content

System prompt improvements, skill system_urlopener description improv… #263

System prompt improvements, skill system_urlopener description improv…

System prompt improvements, skill system_urlopener description improv… #263

Workflow file for this run

name: Testing Release Build
on:
push:
# branches: [ testing ]
tags:
- 'testing-*'
- 'v*'
# pull_request:
# branches: [ testing ]
jobs:
build:
strategy:
matrix:
include:
# - os: macos-14
# python-version: '3.12'
- os: windows-latest
python-version: '3.12'
# - os: ubuntu-latest
# python-version: '3.12'
runs-on: ${{ matrix.os }}
# Add permissions block here for the job
permissions:
contents: write
packages: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }} # Checkout the specific tag that triggered the workflow
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Create virtual environment
shell: bash
run: |
python -m venv venv
if [ "${{ runner.os }}" == "Windows" ]; then
source venv/Scripts/activate
else
source venv/bin/activate
fi
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
- name: Verify Python version
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
source venv/Scripts/activate
venv/Scripts/python.exe --version
else
source venv/bin/activate
python --version # Verify correct Python version
fi
- name: Install dependencies
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
source venv/scripts/activate
venv/Scripts/python.exe -m pip install --upgrade pip
venv/Scripts/python.exe -m pip install -r requirements.txt
else
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
fi
- name: Install project in editable mode
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
source venv/scripts/activate
venv/Scripts/python.exe -m pip install -e .
else
source venv/bin/activate
pip install -e .
fi
- name: Show location and files
shell: bash
run: |
pwd
ls
- name: Run build script
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
source venv/scripts/activate
else
source venv/bin/activate
fi
chmod +x scripts/build
scripts/build --skip-npm-build --skip-git-tag
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Matches Electron and other dependencies version requirements
- name: Install npm dependencies
shell: bash
run: |
npm install
- name: Build frontend for ${{ matrix.os }}
shell: bash
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
npm run build:linux
elif [ "${{ matrix.os }}" == "macos-14" ]; then
npm run build:mac:arm64
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
npm run build:mac:x64
else
npm run build:win
fi
- name: Determine Archive Name
id: archive_name
shell: bash
run: |
# Extract tag name (e.g., testing-v1.0.0)
TAG_NAME="${{ github.ref_name }}"
# Extract branch part (e.g., testing)
BRANCH_PART="${TAG_NAME%-v*}"
# Extract version part (e.g., v1.0.0)
VERSION_PART="${TAG_NAME#*-}"
# Clean the OS name (e.g., macos-latest -> macos, macos-14 -> macos)
OS_NAME="$(echo "${{ matrix.os }}" | sed 's/-latest$//' | sed 's/-[0-9]*$//')"
# Add architecture detection
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
ARCH="arm64"
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
ARCH="x64"
else
ARCH=""
fi
# Construct the desired filename, use .exe for Windows
if [ "${{ runner.os }}" == "Windows" ]; then
echo "ARCHIVE_FILENAME=ainara-polaris-${BRANCH_PART}-${VERSION_PART}-${OS_NAME}.exe" >> $GITHUB_ENV
echo "VERSION_PART=${VERSION_PART}" >> $GITHUB_ENV
echo "Generated filename: ainara-polaris-${BRANCH_PART}-${VERSION_PART}-${OS_NAME}.exe"
elif [[ "${{ runner.os }}" == "macOS" ]]; then
echo "ARCHIVE_FILENAME=ainara-polaris-${BRANCH_PART}-${VERSION_PART}-${OS_NAME}-${ARCH}.dmg" >> $GITHUB_ENV
echo "VERSION_PART=${VERSION_PART}" >> $GITHUB_ENV
echo "Generated filename: ainara-polaris-${BRANCH_PART}-${VERSION_PART}-${OS_NAME}-${ARCH}.dmg"
else
# Assuming Linux still uses zip for now
echo "ARCHIVE_FILENAME=ainara-polaris-${BRANCH_PART}-${VERSION_PART}-${OS_NAME}.zip" >> $GITHUB_ENV
echo "VERSION_PART=${VERSION_PART}" >> $GITHUB_ENV
echo "Generated filename: ainara-polaris-${BRANCH_PART}-${VERSION_PART}-${OS_NAME}.zip"
fi
# Output version part for use in other steps
echo "version-part=${VERSION_PART}" >> $GITHUB_OUTPUT
- name: Debug VERSION_PART
shell: bash
run: |
echo "VERSION_PART is: ${{ steps.archive_name.outputs.version-part }}"
echo "All env vars:"
env | grep VERSION
- name: Create Archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
# Do not remove dist/servers as it's needed for the NSIS installer
# Copy latest.yml to dist if it exists
if (Test-Path "latest.yml") {
Copy-Item "latest.yml" -Destination dist\
}
# Find the NSIS installer generated by electron-builder
$installerPath = Get-ChildItem -Path "dist" -Filter "Ainara Polaris Setup *.exe" | Select-Object -First 1
if ($installerPath) {
Move-Item -Path $installerPath.FullName -Destination ${{ env.ARCHIVE_FILENAME }}
Write-Host "Renamed installer to ${{ env.ARCHIVE_FILENAME }}"
} else {
Write-Error "NSIS installer not found in dist directory"
exit 1
}
- name: Create YAML Metadata for installer (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$exePath = "${{ env.ARCHIVE_FILENAME }}"
$exeSize = (Get-Item $exePath).Length
$sha512 = (Get-FileHash -Path $exePath -Algorithm SHA512).Hash.ToLower()
$yamlContent = "version: ${{ steps.archive_name.outputs.version-part }}`nfiles:`n - url: ${{ env.ARCHIVE_FILENAME }}`n sha512: $sha512`n size: $exeSize`npath: ${{ env.ARCHIVE_FILENAME }}`nsha512: $sha512`nreleaseDate: $(Get-Date -Format 'yyyy-MM-ddTHH:mm:ss.fffZ')"
Set-Content -Path "latest.yml" -Value $yamlContent
Copy-Item "latest.yml" -Destination "${{ env.ARCHIVE_FILENAME }}.yml"
- name: Create Archive (macOS/Linux)
if: runner.os != 'Windows'
shell: bash
run: |
if [[ "${{ matrix.os }}" == "macos-latest" ]] || [[ "${{ matrix.os }}" == "macos-14" ]]; then
# Find the generated DMG file (electron-builder names it like 'ProductName-Version.dmg')
# For electron-builder, artifactName is "${productName}-${version}-${arch}.${ext}"
# Example: "Ainara Polaris-0.5.2-arm64.dmg" or "Ainara Polaris-0.5.2-x64.dmg"
# The version part comes from steps.archive_name.outputs.version-part
# The arch part comes from the build command or can be inferred.
BUILT_ARCH="x64" # Default for macos-latest
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
BUILT_ARCH="arm64"
fi
# Construct the expected DMG name from electron-builder
# Note: package.json version is used by electron-builder, not necessarily the tag version part.
# We need to get the version from package.json or rely on a pattern.
# A simpler find might be better if the version in the tag doesn't match package.json exactly.
DMG_PATTERN="dist/Ainara Polaris-*${BUILT_ARCH}.dmg"
DMG_PATH=$(find dist -maxdepth 1 -name "Ainara Polaris*${BUILT_ARCH}.dmg" -print -quit)
if [ -z "$DMG_PATH" ]; then
echo "Error: DMG file matching pattern '${DMG_PATTERN}' not found in dist directory."
ls -R dist # List contents for debugging
exit 1
fi
echo "Found DMG: $DMG_PATH"
# Rename the DMG to the desired archive filename
mv "$DMG_PATH" "${{ env.ARCHIVE_FILENAME }}"
echo "Renamed DMG to ${{ env.ARCHIVE_FILENAME }}"
else
# Keep existing Linux logic (assuming zip for now)
rm -rf dist/servers
[ -f "latest-linux.yml" ] && cp latest-linux.yml dist/
zip -r ${{ env.ARCHIVE_FILENAME }} dist/
fi
- name: Create YAML Metadata for DMG (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
dmg_path="${{ env.ARCHIVE_FILENAME }}"
dmg_size=$(stat -f %z "$dmg_path")
sha512=$(shasum -a 512 "$dmg_path" | awk '{print tolower($1)}')
ARCHIVE_FILENAME="${{ env.ARCHIVE_FILENAME }}"
RELEASE_DATE=$(date -u +'%Y-%m-%dT%H:%M:%S.%3NZ')
echo "version: ${{ steps.archive_name.outputs.version-part }}" > "latest-mac.yml"
echo "files:" >> "latest-mac.yml"
echo " - url: $ARCHIVE_FILENAME" >> "latest-mac.yml"
echo " sha512: $sha512" >> "latest-mac.yml"
echo " size: $dmg_size" >> "latest-mac.yml"
echo "path: $ARCHIVE_FILENAME" >> "latest-mac.yml"
echo "sha512: $sha512" >> "latest-mac.yml"
echo "releaseDate: $RELEASE_DATE" >> "latest-mac.yml"
cp "latest-mac.yml" "${{ env.ARCHIVE_FILENAME }}.yml"
- name: Package testing artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_FILENAME }}
path: ${{ env.ARCHIVE_FILENAME }}
if-no-files-found: error
# Prepare platform-specific update YAML file name
- name: Set update YAML filename
id: set_yaml_filename
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
echo "UPDATE_YAML=latest.yml" >> $GITHUB_ENV
elif [ "${{ runner.os }}" == "macOS" ]; then
echo "UPDATE_YAML=latest-mac.yml" >> $GITHUB_ENV
elif [ "${{ runner.os }}" == "Linux" ]; then
echo "UPDATE_YAML=latest-linux.yml" >> $GITHUB_ENV
fi
# Rename the YAML file to the platform-specific name
- name: Prepare update YAML file
shell: bash
run: |
if [ -f "${{ env.ARCHIVE_FILENAME }}.yml" ]; then
cp "${{ env.ARCHIVE_FILENAME }}.yml" "${{ env.UPDATE_YAML }}"
fi
- name: Create Release
# Only run this step if the workflow was triggered by a tag push
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
body: |
Automated release from tag.
OS: ${{ matrix.os }}
Python: ${{ matrix.python-version }}
SHA: ${{ github.sha }}
draft: false
prerelease: ${{ startsWith(github.ref_name, 'testing-') }}
files: |
${{ env.ARCHIVE_FILENAME }}
${{ env.ARCHIVE_FILENAME }}.yml
${{ env.UPDATE_YAML }}