Skip to content

andredestro/setup-xcode-version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup Xcode Action

A GitHub Action that selects the desired Xcode version using xcode-select with improved logging and validation.

Features

  • Smart validation - Validates Xcode availability before switching
  • Efficient execution - Skips execution if already using correct version
  • Enhanced logging - Improved error handling with emoji indicators
  • Helpful diagnostics - Lists available Xcode versions on failure
  • Robust error handling - Comprehensive error checking and reporting

Usage

- name: Setup Xcode
  uses: andredestro/setup-xcode-version@v1
  with:
    xcode-version: '26.2'

Inputs

Input Description Required Default
xcode-version The Xcode version to select (e.g., 26.2, 16.4) Yes -

Outputs

Output Description
previous-version The Xcode version that was previously selected
current-version The Xcode version that is now selected

Example Workflows

Basic iOS Build

name: iOS Build
on: [push, pull_request]

jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Xcode 26.2
        uses: andredestro/setup-xcode-version@v1
        with:
          xcode-version: '26.2'
          
      - name: Build iOS App
        run: xcodebuild build -project MyApp.xcodeproj -scheme MyApp

Matrix Build with Multiple Xcode Versions

name: Multi-Xcode Test
on: [push, pull_request]

jobs:
  test:
    runs-on: macos-latest
    strategy:
      matrix:
        xcode-version: ['16.4', '26.1.1', '26.2']
    
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Xcode ${{ matrix.xcode-version }}
        uses: andredestro/setup-xcode-version@v1
        with:
          xcode-version: ${{ matrix.xcode-version }}
          
      - name: Run Tests
        run: xcodebuild test -project MyApp.xcodeproj -scheme MyApp

Using Outputs

- name: Setup Xcode
  id: setup-xcode
  uses: andredestro/setup-xcode-version@v1
  with:
    xcode-version: '26.2'

- name: Show Version Info
  run: |
    echo "Previous version: ${{ steps.setup-xcode.outputs.previous-version }}"
    echo "Current version: ${{ steps.setup-xcode.outputs.current-version }}"

Sample Output

🔍 Checking current Xcode configuration...
📍 Current Xcode path: /Applications/Xcode_16.4.app/Contents/Developer
🔍 Checking if Xcode 26.2 is available...
🔧 Setting Xcode version to 26.2...
✅ Successfully set Xcode to version 26.2
📍 New Xcode path: /Applications/Xcode_26.2.app/Contents/Developer
xcode-select version 2397.

Requirements

  • Runners: macOS runners only (macos-latest, macos-14, etc.)
  • Xcode: Target Xcode version must be pre-installed on the runner
  • Permissions: The action requires sudo access for xcode-select

Error Handling

If the specified Xcode version is not found, the action will:

  1. ❌ Display a clear error message
  2. 📋 List all available Xcode versions
  3. 🚫 Fail the workflow with exit code 1

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions:

  1. Check the GitHub Issues
  2. Create a new issue with detailed information about your problem
  3. Include the action logs and your workflow configuration

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published