|
| 1 | +# GitHub Actions for Z AI SDK Ruby |
| 2 | + |
| 3 | +This repository includes several GitHub Actions workflows to automate the development and release process for your Ruby gem. |
| 4 | + |
| 5 | +## Workflows |
| 6 | + |
| 7 | +### 1. CI Workflow (`.github/workflows/ci.yml`) |
| 8 | +- **Triggers**: Push to main/develop branches, pull requests to main |
| 9 | +- **Features**: |
| 10 | + - Tests on Ruby 2.7, 3.0, 3.1, 3.2 |
| 11 | + - RuboCop code style checks |
| 12 | + - Code coverage analysis |
| 13 | + - Gem building and artifact upload |
| 14 | + - OpenSpec change detection |
| 15 | + |
| 16 | +### 2. Release Workflow (`.github/workflows/release.yml`) |
| 17 | +- **Triggers**: Git tags starting with `v*` |
| 18 | +- **Features**: |
| 19 | + - Automatic GitHub Release creation |
| 20 | + - Changelog generation from git commits |
| 21 | + - Gem artifact upload to release |
| 22 | + - RubyGems publishing |
| 23 | + |
| 24 | +### 3. OpenSpec Phase Tagging (`.github/workflows/openspec-phases.yml`) |
| 25 | +- **Triggers**: |
| 26 | + - Changes to `openspec/` directory |
| 27 | + - Manual workflow dispatch |
| 28 | +- **Features**: |
| 29 | + - Automatic detection of completed OpenSpec phases |
| 30 | + - Phase-based tagging (e.g., `feature-name-v1.2.3`) |
| 31 | + - GitHub release creation for phase completion |
| 32 | + - Manual phase tagging option |
| 33 | + |
| 34 | +### 4. Publish Workflow (`.github/workflows/publish.yml`) |
| 35 | +- **Triggers**: Manual workflow dispatch or called from other workflows |
| 36 | +- **Features**: |
| 37 | + - RubyGems version checking |
| 38 | + - Safe publishing (skips if version exists) |
| 39 | + - GitHub release creation |
| 40 | + - Gem building and validation |
| 41 | + |
| 42 | +## Required Secrets |
| 43 | + |
| 44 | +To use these workflows, add the following secrets to your GitHub repository: |
| 45 | + |
| 46 | +1. **GITHUB_TOKEN**: Automatically provided by GitHub Actions |
| 47 | +2. **RUBYGEMS_API_KEY**: Your RubyGems API key for publishing gems |
| 48 | + |
| 49 | +## Usage |
| 50 | + |
| 51 | +### Automated Releases |
| 52 | +1. Complete your development work |
| 53 | +2. Create and push a version tag: |
| 54 | + ```bash |
| 55 | + git tag v1.0.0 |
| 56 | + git push origin v1.0.0 |
| 57 | + ``` |
| 58 | +3. The release workflow will automatically: |
| 59 | + - Run all tests |
| 60 | + - Build the gem |
| 61 | + - Create a GitHub release |
| 62 | + - Publish to RubyGems |
| 63 | + |
| 64 | +### Phase-based Development with OpenSpec |
| 65 | +1. Create OpenSpec changes in the `openspec/changes/` directory |
| 66 | +2. Complete all tasks in your change |
| 67 | +3. Push to main branch |
| 68 | +4. The OpenSpec Phase Tagging workflow will: |
| 69 | + - Detect completed changes |
| 70 | + - Create phase-specific tags |
| 71 | + - Create GitHub releases for each phase |
| 72 | + |
| 73 | +### Manual Phase Tagging |
| 74 | +1. Go to Actions tab in GitHub |
| 75 | +2. Select "OpenSpec Phase Tagging" workflow |
| 76 | +3. Click "Run workflow" |
| 77 | +4. Enter phase name and optional version |
| 78 | +5. The workflow will create a tag and release for your phase |
| 79 | + |
| 80 | +### Manual Gem Publishing |
| 81 | +1. Go to Actions tab in GitHub |
| 82 | +2. Select "Publish Gem" workflow |
| 83 | +3. Click "Run workflow" |
| 84 | +4. The workflow will build and publish your gem if the version doesn't exist |
| 85 | + |
| 86 | +## Tag Naming Convention |
| 87 | + |
| 88 | +- **Version tags**: `v1.2.3` (triggers full release) |
| 89 | +- **Phase tags**: `feature-name-v1.2.3` (triggers phase release) |
| 90 | +- **Manual tags**: Use workflow dispatch for custom naming |
| 91 | + |
| 92 | +## Integration with OpenSpec |
| 93 | + |
| 94 | +The workflows are designed to work seamlessly with OpenSpec: |
| 95 | + |
| 96 | +1. **Phase Detection**: Automatically detects when all tasks in a change are complete |
| 97 | +2. **Change Documentation**: Includes OpenSpec proposal and task information in releases |
| 98 | +3. **Archive Integration**: Works with the OpenSpec archive-change skill |
| 99 | + |
| 100 | +## Local Development |
| 101 | + |
| 102 | +To test workflows locally, you can use `act` (GitHub Actions runner): |
| 103 | + |
| 104 | +```bash |
| 105 | +# Install act |
| 106 | +curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash |
| 107 | + |
| 108 | +# Run workflow |
| 109 | +act -j test |
| 110 | +``` |
| 111 | + |
| 112 | +## Troubleshooting |
| 113 | + |
| 114 | +- **RubyGems Publishing**: Ensure your `RUBYGEMS_API_KEY` is correct and has publish permissions |
| 115 | +- **Tag Conflicts**: Make sure tag names are unique and follow the semver pattern |
| 116 | +- **OpenSpec Detection**: Ensure changes are in the correct directory with completed tasks |
0 commit comments