Skip to content

Commit a73da1a

Browse files
authored
ci: tag the api module with every release (#270)
1 parent 116e2a7 commit a73da1a

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,24 @@ jobs:
187187
--generate-notes \
188188
--latest=${{ steps.version.outputs.is_latest }} \
189189
func-operator.yaml
190+
191+
# api/ is a separate Go module, versioned by tags with an api/ prefix.
192+
# Tag it on the same commit with every release, so other projects (e.g. knative/func)
193+
# can use the CRD types that match this operator version.
194+
- name: Tag api module
195+
run: |
196+
TAG="api/v${{ steps.version.outputs.full }}"
197+
198+
# Release branches before release-0.4 have no api module
199+
if [ ! -f api/go.mod ]; then
200+
echo "No api module at this commit, skipping"
201+
exit 0
202+
fi
203+
204+
if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
205+
echo "Tag $TAG already exists, skipping"
206+
exit 0
207+
fi
208+
209+
git tag "$TAG"
210+
git push origin "$TAG"

‎docs/release.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ For each tag, the `release` workflow:
4343

4444
4. **Creates a GitHub release** with auto-generated release notes and the install manifest attached
4545

46+
5. **Tags the `api` Go module** with `api/v{VERSION}` on the same commit, so other projects (e.g. knative/func) can import the CRD types that match this release:
47+
```bash
48+
go get github.com/functions-dev/func-operator/api@v{VERSION}
49+
```
50+
The tag is created for every release, even when `api/` did not change. It is skipped when the commit has no api module (release branches before `release-0.4`).
51+
4652
## Nightly Builds
4753

4854
The `nightly-build` workflow runs daily at 00:00 UTC and pushes images from `main` tagged as `:main`.

0 commit comments

Comments
 (0)