Skip to content

Set workspace on app creation #56

Set workspace on app creation

Set workspace on app creation #56

Workflow file for this run

name: Build CLI binaries
on:
pull_request:
paths:
- "cli/**"
- ".github/workflows/cli-build.yml"
push:
branches:
- dev
- prod
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: ${{ matrix.artifact_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.11"
artifact_name: stacksync-linux-x64
binary_name: stacksync
artifact_path: cli/dist/stacksync-linux-x64
- os: ubuntu-24.04-arm
python-version: "3.11"
artifact_name: stacksync-linux-arm64
binary_name: stacksync
artifact_path: cli/dist/stacksync-linux-arm64
- os: macos-latest
python-version: "3.11"
artifact_name: stacksync-macos-arm64
binary_name: stacksync
artifact_path: cli/dist/stacksync-macos-arm64
- os: windows-latest
python-version: "3.11"
artifact_name: stacksync-windows-x64.exe
binary_name: stacksync.exe
artifact_path: cli/dist/stacksync-windows-x64.exe
defaults:
run:
working-directory: cli
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Create virtual environment
shell: bash
run: python -m venv .venv
- name: Build standalone binary
if: runner.os != 'Windows'
shell: bash
run: |
source .venv/bin/activate
./scripts/build-binary.sh
- name: Build standalone binary
if: runner.os == 'Windows'
shell: pwsh
run: |
.\.venv\Scripts\python -m pip install -U pip
.\.venv\Scripts\python -m pip install -e .
.\.venv\Scripts\python -m pip install -r requirements-dev.txt
.\.venv\Scripts\python -m PyInstaller --clean --noconfirm stacksync.spec
- name: Rename release artifact
if: runner.os != 'Windows'
shell: bash
run: cp "dist/${{ matrix.binary_name }}" "dist/${{ matrix.artifact_name }}"
- name: Rename release artifact
if: runner.os == 'Windows'
shell: pwsh
run: Copy-Item "dist\${{ matrix.binary_name }}" "dist\${{ matrix.artifact_name }}"
- name: Smoke test binary
if: runner.os != 'Windows'
shell: bash
run: "./dist/${{ matrix.artifact_name }} --help"
- name: Smoke test binary
if: runner.os == 'Windows'
shell: pwsh
run: .\dist\${{ matrix.artifact_name }} --help
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_path }}
if-no-files-found: error
release:
name: Publish GitHub release
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/prod' || startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
- name: Compute release metadata
id: release_meta
shell: bash
run: |
if [[ "${GITHUB_REF}" == "refs/heads/dev" ]]; then
echo "tag_name=dev" >> "${GITHUB_OUTPUT}"
echo "release_name=Dev CLI Build" >> "${GITHUB_OUTPUT}"
echo "prerelease=true" >> "${GITHUB_OUTPUT}"
echo "make_latest=false" >> "${GITHUB_OUTPUT}"
elif [[ "${GITHUB_REF}" == "refs/heads/prod" ]]; then
echo "tag_name=prod" >> "${GITHUB_OUTPUT}"
echo "release_name=Prod CLI Build" >> "${GITHUB_OUTPUT}"
echo "prerelease=false" >> "${GITHUB_OUTPUT}"
echo "make_latest=true" >> "${GITHUB_OUTPUT}"
else
echo "tag_name=${GITHUB_REF_NAME}" >> "${GITHUB_OUTPUT}"
echo "release_name=${GITHUB_REF_NAME}" >> "${GITHUB_OUTPUT}"
echo "prerelease=false" >> "${GITHUB_OUTPUT}"
echo "make_latest=true" >> "${GITHUB_OUTPUT}"
fi
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release_meta.outputs.tag_name }}
name: ${{ steps.release_meta.outputs.release_name }}
target_commitish: ${{ github.sha }}
prerelease: ${{ steps.release_meta.outputs.prerelease }}
make_latest: ${{ steps.release_meta.outputs.make_latest }}
overwrite_files: true
generate_release_notes: ${{ !startsWith(github.ref, 'refs/heads/') }}
files: |
release-assets/stacksync-linux-x64/stacksync-linux-x64
release-assets/stacksync-linux-arm64/stacksync-linux-arm64
release-assets/stacksync-macos-arm64/stacksync-macos-arm64
release-assets/stacksync-windows-x64.exe/stacksync-windows-x64.exe