Skip to content

Commit bc7e60a

Browse files
committed
docs: update workflows to use contractual-dev/action and document release automation
1 parent d316654 commit bc7e60a

2 files changed

Lines changed: 44 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
name: Version Contracts
1+
name: Release Contracts
22

33
on:
44
push:
55
branches:
66
- main
7-
paths:
8-
- '.contractual/changesets/**'
9-
- '!.contractual/changesets/.gitkeep'
107

118
permissions:
129
contents: write
1310
pull-requests: write
1411

1512
jobs:
16-
version:
13+
release:
1714
runs-on: ubuntu-latest
1815
steps:
1916
- name: Checkout code
2017
uses: actions/checkout@v4
2118
with:
2219
fetch-depth: 0
2320

24-
- name: Version Contracts
25-
id: version
21+
- name: Release Contracts
22+
id: release
2623
uses: contractual-dev/action@v1
2724
with:
2825
mode: release
@@ -31,9 +28,19 @@ jobs:
3128
tag-prefix: 'contract'
3229
attach-specs: 'true'
3330

34-
- name: Summary
35-
if: steps.version.outputs.version-pr-url
31+
- name: Release Summary
32+
if: always()
3633
run: |
37-
echo "📦 Version PR: ${{ steps.version.outputs.version-pr-url }}"
38-
echo "🏷️ Tags created: ${{ steps.version.outputs.created-tags }}"
39-
echo "🚀 Releases: ${{ steps.version.outputs.release-urls }}"
34+
echo "### Release Summary" >> $GITHUB_STEP_SUMMARY
35+
if [ -n "${{ steps.release.outputs.version-pr-url }}" ]; then
36+
echo "📦 Version PR created: ${{ steps.release.outputs.version-pr-url }}" >> $GITHUB_STEP_SUMMARY
37+
fi
38+
if [ -n "${{ steps.release.outputs.created-tags }}" ]; then
39+
echo "🏷️ Tags: ${{ steps.release.outputs.created-tags }}" >> $GITHUB_STEP_SUMMARY
40+
fi
41+
if [ -n "${{ steps.release.outputs.release-urls }}" ]; then
42+
echo "🚀 Releases: ${{ steps.release.outputs.release-urls }}" >> $GITHUB_STEP_SUMMARY
43+
fi
44+
if [ -n "${{ steps.release.outputs.bumped-versions }}" ]; then
45+
echo "📈 Bumped: ${{ steps.release.outputs.bumped-versions }}" >> $GITHUB_STEP_SUMMARY
46+
fi

README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,31 @@ When you open a PR with spec changes:
102102

103103
If breaking changes are detected or no changeset exists, the check fails.
104104

105-
### Release Workflow
106-
107-
When a PR with changesets is merged to `main`:
108-
109-
1. **Consume Changesets**: Reads all pending changesets
110-
2. **Bump Versions**: Applies semantic version bumps
111-
3. **Update Changelog**: Appends changes to `CHANGELOG.md`
112-
4. **Snapshot Spec**: Copies current spec to `.contractual/snapshots/`
113-
5. **Commit & Push**: Commits changes back to main
105+
### Release Workflow (Automated)
106+
107+
The release workflow uses the **Changesets pattern** with two phases:
108+
109+
#### **Phase 1: Version PR Creation**
110+
When changesets are merged to `main`:
111+
112+
1. **Detect Changesets**: Checks if changesets exist in `.contractual/changesets/`
113+
2. **Create Version PR**: Opens/updates a PR named "Version Contracts" that:
114+
- Runs `contractual version` to bump versions
115+
- Updates `CHANGELOG.md` with changes
116+
- Updates snapshots in `.contractual/snapshots/`
117+
- Removes consumed changesets
118+
3. **PR Review**: Team reviews the version bumps before release
119+
120+
#### **Phase 2: Release Creation**
121+
When the Version PR is merged to `main`:
122+
123+
1. **Detect Version Bump**: Checks if `versions.json` changed
124+
2. **Create Git Tags**: Tags like `petstore@1.1.0` for each versioned contract
125+
3. **Create GitHub Releases**: One release per contract with:
126+
- Changelog excerpt for that contract
127+
- Attached OpenAPI spec file from snapshots
128+
- Release notes with breaking change warnings
129+
4. **Publish**: (Optional, Phase 3) Publish to package registries
114130

115131
---
116132

0 commit comments

Comments
 (0)