Skip to content

Commit 5fbb531

Browse files
committed
ci: add release workflow
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent beb2a9c commit 5fbb531

3 files changed

Lines changed: 142 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Internal - Prepare release
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
types: [opened, reopened, synchronize, edited]
10+
11+
permissions: {}
12+
13+
jobs:
14+
release:
15+
uses: hoverkraft-tech/ci-github-publish/.github/workflows/prepare-release.yml@f06e0e72a76bfca57c34d08d03e5c1914275fd4c # 2.0.0
16+
permissions:
17+
contents: read
18+
pull-requests: write

‎.github/workflows/__release.yml‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
name: Internal - Release
3+
4+
on: # yamllint disable-line rule:truthy
5+
workflow_dispatch:
6+
# checkov:skip=CKV_GHA_7: force only bypasses the no-changes guard; source and CI settings stay fixed.
7+
inputs:
8+
force:
9+
description: "Release even when no relevant changes are detected."
10+
type: boolean
11+
required: false
12+
default: false
13+
14+
schedule:
15+
- cron: "25 8 * * 1"
16+
17+
permissions: {}
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: false
22+
23+
jobs:
24+
ci:
25+
if: github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch
26+
uses: $/.github/workflows/__shared-ci.yml
27+
permissions:
28+
actions: read
29+
contents: read
30+
id-token: write
31+
issues: write
32+
packages: read
33+
pull-requests: write
34+
security-events: write
35+
statuses: write
36+
37+
release:
38+
name: Create and publish release
39+
needs: ci
40+
runs-on: ubuntu-latest
41+
permissions:
42+
contents: read
43+
pull-requests: read
44+
steps:
45+
# Use the app token so publishing the tag triggers the main CI documentation jobs.
46+
- id: generate-token
47+
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
48+
with:
49+
client-id: ${{ vars.CI_BOT_APP_CLIENT_ID }}
50+
private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env] CI bot authentication is required to trigger tag workflows
51+
permission-contents: write
52+
permission-pull-requests: read
53+
54+
- name: Plan release
55+
id: plan-release
56+
uses: hoverkraft-tech/ci-github-publish/actions/release/plan@f06e0e72a76bfca57c34d08d03e5c1914275fd4c # 2.0.0
57+
with:
58+
target-sha: ${{ github.sha }}
59+
github-token: ${{ steps.generate-token.outputs.token }}
60+
61+
- name: Create and publish release
62+
if: (steps.plan-release.outputs.has-changes == 'true' || (github.event_name == 'workflow_dispatch' && inputs.force)) && steps.plan-release.outputs.tag != ''
63+
uses: hoverkraft-tech/ci-github-publish/actions/release/create@f06e0e72a76bfca57c34d08d03e5c1914275fd4c # 2.0.0
64+
env:
65+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} # zizmor: ignore[secrets-outside-env] repository secret is scoped to the release summary step
66+
with:
67+
tag: ${{ steps.plan-release.outputs.tag }}
68+
target-sha: ${{ github.sha }}
69+
publish: "true"
70+
changelog-summary: |
71+
{
72+
"llmAuth": ${{ toJSON(env.OPENAI_API_KEY) }},
73+
"llmProvider": "openai"
74+
}
75+
github-token: ${{ steps.generate-token.outputs.token }}

‎docs/development/releases.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Releases
2+
3+
The repository uses the shared Hoverkraft release actions to calculate versions,
4+
publish GitHub releases, and generate release summaries.
5+
6+
## Release preparation
7+
8+
[Prepare release](../../.github/workflows/__prepare-release.yml) runs on pushes to
9+
`main` and when pull requests targeting `main` are opened, reopened, updated, or
10+
edited. It applies the shared Conventional Commit labels to pull requests.
11+
12+
The shared release configuration increments the major version for breaking
13+
changes, the minor version for features, and the patch version for other changes.
14+
Tags use the existing `MAJOR.MINOR.PATCH` format. No repository override is needed
15+
for these defaults.
16+
17+
## Publishing
18+
19+
[Release](../../.github/workflows/__release.yml) runs every Monday at 08:25 UTC and
20+
supports manual dispatch. It runs only on the default branch and:
21+
22+
1. Runs the shared CI workflow.
23+
2. Plans a release for the exact commit validated by CI.
24+
3. Creates and publishes the release when relevant changes exist and a tag was
25+
planned. Release notes include a generated summary.
26+
27+
Failed or skipped CI prevents publication. Concurrent release runs are serialized.
28+
The GitHub App token lets the new tag trigger
29+
[main CI](../../.github/workflows/__main-ci.yml), which regenerates action and
30+
workflow documentation and sends its artifact to the public documentation site.
31+
32+
To release manually, open **Actions → Internal - Release → Run workflow** and
33+
select `main`. Leave `force` disabled for normal releases. Enable it only to bypass
34+
the no-changes check; the default-branch restriction, CI checks, and planned-tag
35+
requirement still apply.
36+
37+
## Credentials
38+
39+
The workflow uses repository or inherited organization settings:
40+
41+
| Setting | Kind | Purpose |
42+
| ------------------------ | -------- | ------------------------------------------------------------------------------- |
43+
| `CI_BOT_APP_CLIENT_ID` | Variable | Identify the installed CI bot GitHub App. |
44+
| `CI_BOT_APP_PRIVATE_KEY` | Secret | Create an installation token with Contents write and Pull requests read access. |
45+
| `OPENAI_API_KEY` | Secret | Generate the release summary. |
46+
47+
The GitHub App must be installed on this repository and allowed to create release
48+
tags. Keep these settings available to the repository before enabling scheduled
49+
releases.

0 commit comments

Comments
 (0)