Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Commit 7533f34

Browse files
committed
remove version auto increment, add release process documentation
1 parent ee8fef7 commit 7533f34

File tree

2 files changed

+152
-31
lines changed

2 files changed

+152
-31
lines changed

.github/workflows/tag_release.yaml

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@ jobs:
2525
- name: Calculate next version
2626
id: version
2727
run: |
28-
# Try to extract version from PR title first
29-
pr_title=""
30-
if [ "${{ github.event_name }}" == "push" ]; then
28+
new_version=""
29+
30+
# If manual dispatch with set_version, use that (highest priority)
31+
if [ -n "${{ github.event.inputs.set_version }}" ]; then
32+
new_version="${{ github.event.inputs.set_version }}"
33+
# Add 'v' prefix if not present
34+
if [[ ! $new_version =~ ^v ]]; then
35+
new_version="v$new_version"
36+
fi
37+
echo "Using manual version: $new_version"
38+
# If push event, try to extract version from PR title
39+
elif [ "${{ github.event_name }}" == "push" ]; then
3140
# Get the PR title from the merge commit message
3241
commit_message=$(git log -1 --format='%s')
3342
echo "Commit message: $commit_message"
@@ -38,39 +47,22 @@ jobs:
3847
new_version="v$extracted_version"
3948
echo "Extracted version from PR title: $new_version"
4049
else
41-
echo "Could not extract version from commit message, falling back to auto-increment"
42-
extracted_version=""
50+
echo "❌ Could not extract version from commit message"
51+
echo "Expected format: 'chore: 🐝 Update SDK - Generate X.X.X'"
52+
echo "Actual message: $commit_message"
4353
fi
4454
fi
4555
46-
# If manual dispatch with set_version, use that
47-
if [ -n "${{ github.event.inputs.set_version }}" ]; then
48-
new_version="${{ github.event.inputs.set_version }}"
49-
# Add 'v' prefix if not present
50-
if [[ ! $new_version =~ ^v ]]; then
51-
new_version="v$new_version"
52-
fi
53-
echo "Using manual version: $new_version"
54-
# If we extracted version from PR title, use that
55-
elif [ -n "$extracted_version" ]; then
56-
new_version="v$extracted_version"
57-
echo "Using extracted version: $new_version"
58-
else
59-
# Fall back to auto-increment
60-
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.2.6")
61-
echo "Latest tag: $latest_tag"
62-
63-
# Extract version numbers and increment patch
64-
version=${latest_tag#v}
65-
IFS='.' read -r major minor patch <<< "$version"
66-
67-
# Increment patch version
68-
new_patch=$((patch + 1))
69-
new_version="v$major.$minor.$new_patch"
70-
echo "Auto-incremented version: $new_version"
56+
# Validate that we have a version
57+
if [ -z "$new_version" ]; then
58+
echo "❌ No version could be determined. Workflow will exit."
59+
echo "Please either:"
60+
echo " 1. Use workflow_dispatch with set_version input, or"
61+
echo " 2. Ensure PR title contains 'Generate X.X.X' pattern"
62+
exit 1
7163
fi
7264
73-
echo "Final version: $new_version"
65+
echo "Final version: $new_version"
7466
echo "new_version=$new_version" >> $GITHUB_OUTPUT
7567
7668
- name: Configure Git

scripts/Readme.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,135 @@ This pipeline is typically run as part of a GitHub Action:
221221
222222
The generated overlay is then used by Speakeasy to create the Terraform provider.
223223
224+
## Release Process
225+
226+
Our automated release process ensures consistent versioning and reliable publishing of the Terraform provider.
227+
228+
### Overview
229+
230+
The release process consists of three main GitHub Actions workflows:
231+
232+
1. **SDK Generation** (`sdk_generation.yaml`) - Daily automated provider generation
233+
2. **Tag Release** (`tag_release.yaml`) - Creates release tags when provider code changes
234+
3. **Release Terraform Provider** (`release.yaml`) - Publishes the provider to registries
235+
236+
### Automated Release Flow
237+
238+
```mermaid
239+
flowchart TD
240+
A [Daily: SDK Generation Workflow] --> [Speakeasy Bot Opens PR]
241+
B --> Merge PR to main
242+
C --> {PR Contains /internal Changes?}
243+
C -->|Yes| [Tag Release Workflow Triggered]
244+
C -->|No| [No release]
245+
D --> [Extract Version from PR Title]
246+
E --> [Create Git Tag]
247+
F --> [Release Workflow Triggered]
248+
G --> [GoReleaser Publishes Provider]
249+
```
250+
251+
### Workflow Details
252+
253+
#### 1. SDK Generation (`sdk_generation.yaml`)
254+
**Triggers:** Daily at midnight, manual dispatch
255+
**Purpose:** Generate updated provider from latest OpenAPI spec
256+
257+
**Process:**
258+
- Fetches latest OpenAPI spec from developers repo
259+
- Runs normalization and overlay scripts
260+
- Generates provider via Speakeasy
261+
- Speakeasy bot opens PR with changes
262+
263+
#### 2. Tag Release (`tag_release.yaml`)
264+
**Triggers:** Push to main with `/internal/**` changes, manual dispatch
265+
**Purpose:** Create release tags with proper versioning
266+
267+
**Version Sources (in priority order):**
268+
1. **Manual dispatch** with `set_version` input
269+
2. **Speakeasy PR title** - Extracts version from pattern: `"chore: 🐝 Update SDK - Generate X.X.X"`
270+
3. **Workflow fails** if no version found (no auto-increment to prevent wrong versions)
271+
272+
**Process:**
273+
- Detects version from PR title or manual input
274+
- Creates annotated Git tag (e.g., `v0.2.7`)
275+
- Pushes tag to repository
276+
277+
#### 3. Release Terraform Provider (`release.yaml`)
278+
**Triggers:** Git tag creation (`v*` pattern), manual dispatch
279+
**Purpose:** Publish provider to Terraform Registry
280+
281+
**Process:**
282+
- Triggered automatically when tag is created
283+
- Runs GoReleaser to build and publish provider
284+
- Creates GitHub release with assets
285+
- Publishes to Terraform Registry
286+
287+
### Manual Release Process
288+
289+
For manual releases or hotfixes:
290+
291+
1. **Direct tag creation:**
292+
```bash
293+
git tag v0.2.8
294+
git push origin v0.2.8
295+
```
296+
297+
2. **Via workflow dispatch:**
298+
- Go to Actions → "Tag Release" workflow
299+
- Click "Run workflow"
300+
- Set `set_version` to desired version (e.g., `0.2.8`)
301+
- Run workflow
302+
303+
### Version Management
304+
305+
- **Current version scheme:** `v0.2.X` (semantic versioning)
306+
- **Speakeasy determines versions** based on API changes
307+
- **No auto-increment** to prevent accidental releases
308+
- **Version extraction** from PR titles ensures accuracy
309+
310+
### Troubleshooting
311+
312+
#### Tag Mismatch Errors
313+
If you see errors like "git tag v0.2.6 was not made against commit...", fix with:
314+
```bash
315+
git tag -d v0.2.6
316+
git push origin :refs/tags/v0.2.6
317+
git tag v0.2.6
318+
git push origin v0.2.6
319+
```
320+
321+
#### Missing Version in PR
322+
If the Tag Release workflow fails due to missing version:
323+
- Check PR title follows format: `"chore: 🐝 Update SDK - Generate X.X.X"`
324+
- Use manual dispatch with `set_version` as fallback
325+
326+
#### Release Workflow Fails
327+
- Verify tag exists and points to correct commit
328+
- Check GitHub tokens and secrets are configured
329+
- Ensure GoReleaser configuration is valid
330+
331+
### Testing Release Process
332+
333+
To test the release process safely:
334+
335+
1. **Create test branch:**
336+
```bash
337+
git checkout -b test-release
338+
```
339+
340+
2. **Modify tag workflow** to trigger on test branch
341+
3. **Use dry-run mode** to validate without creating actual tags
342+
4. **Test version extraction** with sample commit messages
343+
344+
### Prerequisites
345+
346+
Ensure these secrets are configured in GitHub:
347+
- `GITHUB_TOKEN` (automatic)
348+
- `terraform_gpg_private_key` (for signing)
349+
- `terraform_gpg_passphrase` (for signing)
350+
- `FH_OPS_SSH_KEY` (for accessing developers repo)
351+
- `SPEAKEASY_API_KEY` (for SDK generation)
352+
224353
## Provider Local Testing
225354

226355
After `speakeasy run` has successfully completed.

0 commit comments

Comments
 (0)