Skip to content

Bump version

Bump version #575

Workflow file for this run

name: Styx compile
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
- name: Compile
run: |
uv --directory tooling run wrap build
- name: Set up Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Generate GitHub App token
id: generate-token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Push to component repos
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
ORG_NAME: styx-api
run: |-
# Store absolute path of the workspace
WORKSPACE_DIR=$(pwd)
# Check if dist directory exists
if [ ! -d "$WORKSPACE_DIR/dist" ]; then
echo "No dist directory found, skipping component pushes"
exit 0
fi
# For each subdirectory in dist/
for dir in "$WORKSPACE_DIR/dist"/*/; do
# Extract repo name from directory path
repo_name=$(basename "$dir")
echo "Processing repo: $repo_name"
# Check if repository exists in the organization
repo_check=$(gh repo view "$ORG_NAME/$repo_name" --json name 2>/dev/null || echo "not_found")
# Create a temporary directory for the repo
tmp_dir=$(mktemp -d)
if [[ "$repo_check" == "not_found" ]]; then
echo "Creating new repository: $ORG_NAME/$repo_name"
gh repo create "$ORG_NAME/$repo_name" --public --description "Auto-generated repository for $repo_name"
# For new repos, we'll initialize with the first commit
cd "$tmp_dir"
git init
# Copy all files from the dist directory to the new repo
cp -r "$dir"* .
git add .
git commit -m "Initial commit from Styx compile workflow"
git branch -M main
git remote add origin "https://x-access-token:${GH_TOKEN}@github.com/$ORG_NAME/$repo_name.git"
git push origin main
else
echo "Repository $ORG_NAME/$repo_name already exists, updating it while preserving history"
# Clone the existing repo
git clone "https://x-access-token:${GH_TOKEN}@github.com/$ORG_NAME/$repo_name.git" "$tmp_dir"
# Remove all files (except .git directory) to prepare for new files
cd "$tmp_dir"
find . -mindepth 1 -maxdepth 1 -not -name .git -exec rm -rf {} \;
# Copy all files from the dist directory to the cloned repo
echo "Copying from $dir to $(pwd)"
cp -r "$dir"* .
# Commit and push changes
git add .
# Only commit if there are changes
git diff --cached --quiet || git commit -m "Automated update from Styx compile workflow"
git push origin main
fi
# Return to the workspace directory
cd "$WORKSPACE_DIR"
echo "Successfully pushed to $ORG_NAME/$repo_name"
done