Skip to content

Commit 5c7a7e8

Browse files
committed
feat(workflows): add release lifecycle workflows
Signed-off-by: Emilien Escalle <[email protected]>
1 parent 26e47d6 commit 5c7a7e8

File tree

6 files changed

+474
-99
lines changed

6 files changed

+474
-99
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<!-- header:start -->
2+
3+
# GitHub Reusable Workflow: Release - Finish
4+
5+
<div align="center">
6+
<img src="../logo.svg" width="60px" align="center" alt="Release - Finish" />
7+
</div>
8+
9+
---
10+
11+
<!-- header:end -->
12+
<!-- badges:start -->
13+
14+
[![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-publish)](https://github.com/hoverkraft-tech/ci-github-publish/releases)
15+
[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-publish)](http://choosealicense.com/licenses/mit/)
16+
[![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-publish?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-publish?style=social)
17+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-publish/blob/main/CONTRIBUTING.md)
18+
19+
<!-- badges:end -->
20+
<!-- overview:start -->
21+
22+
## Overview
23+
24+
Reusable workflow — publishes a draft release or deletes it on failure.
25+
Pair with release-start.yml: call this after your gate jobs succeed or fail.
26+
27+
### Permissions
28+
29+
- **`contents`**: `write`
30+
31+
<!-- overview:end -->
32+
<!-- usage:start -->
33+
34+
## Usage
35+
36+
```yaml
37+
name: Release - Finish
38+
on:
39+
push:
40+
branches:
41+
- main
42+
permissions: {}
43+
jobs:
44+
release-finish:
45+
uses: hoverkraft-tech/ci-github-publish/.github/workflows/release-finish.yml@2589abb2627bde4038ac543546a539a827ea2be8 # feat/release-workflows
46+
permissions: {}
47+
with:
48+
# JSON array of runner(s) to use.
49+
# See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job.
50+
#
51+
# Default: `["ubuntu-latest"]`
52+
runs-on: '["ubuntu-latest"]'
53+
54+
# The tag of the draft release to publish or delete (output of the release-start.yml workflow).
55+
# This input is required.
56+
tag: ""
57+
58+
# Set to true to publish the draft, false to delete it.
59+
# Default: `true`
60+
publish: true
61+
```
62+
63+
<!-- usage:end -->
64+
<!-- inputs:start -->
65+
66+
## Inputs
67+
68+
### Workflow Call Inputs
69+
70+
| **Input** | **Description** | **Required** | **Type** | **Default** |
71+
| ------------- | --------------------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- |
72+
| **`runs-on`** | JSON array of runner(s) to use. | **false** | **string** | `["ubuntu-latest"]` |
73+
| | See <https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job>. | | | |
74+
| **`tag`** | The tag of the draft release to publish or delete (output of the release-start.yml workflow). | **true** | **string** | - |
75+
| **`publish`** | Set to true to publish the draft, false to delete it. | **false** | **boolean** | `true` |
76+
77+
<!-- inputs:end -->
78+
<!-- secrets:start -->
79+
<!-- secrets:end -->
80+
<!-- outputs:start -->
81+
<!-- outputs:end -->
82+
<!-- examples:start -->
83+
<!-- examples:end -->
84+
<!-- contributing:start -->
85+
86+
## Contributing
87+
88+
Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-publish/blob/main/CONTRIBUTING.md) for more details.
89+
90+
<!-- contributing:end -->
91+
<!-- security:start -->
92+
<!-- security:end -->
93+
<!-- license:start -->
94+
95+
## License
96+
97+
This project is licensed under the MIT License.
98+
99+
SPDX-License-Identifier: MIT
100+
101+
Copyright © 2026 hoverkraft-tech
102+
103+
For more details, see the [license](http://choosealicense.com/licenses/mit/).
104+
105+
<!-- license:end -->
106+
<!-- generated:start -->
107+
108+
---
109+
110+
This documentation was automatically generated by [CI Dokumentor](https://github.com/hoverkraft-tech/ci-dokumentor).
111+
112+
<!-- generated:end -->
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Reusable workflow — publishes a draft release or deletes it on failure.
2+
# Pair with release-start.yml: call this after your gate jobs succeed or fail.
3+
---
4+
name: Release - Finish
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
runs-on:
10+
description: |
11+
JSON array of runner(s) to use.
12+
See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job.
13+
type: string
14+
default: '["ubuntu-latest"]'
15+
required: false
16+
tag:
17+
description: "The tag of the draft release to publish or delete (output of the release-start.yml workflow)."
18+
type: string
19+
required: true
20+
publish:
21+
description: "Set to true to publish the draft, false to delete it."
22+
type: boolean
23+
default: true
24+
required: false
25+
26+
permissions: {}
27+
28+
jobs:
29+
publish:
30+
if: ${{ !inputs.publish }}
31+
name: Publish draft release
32+
runs-on: ${{ fromJson(inputs.runs-on) }}
33+
permissions:
34+
contents: write
35+
steps:
36+
- id: local-workflow-actions
37+
uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f24ce3360a8abf9bf386a62ab13d0ae5de5f9d13 # 0.31.7
38+
with:
39+
actions-path: actions
40+
41+
- id: create-release
42+
uses: ./self-workflow/actions/release/create
43+
with:
44+
publish: true
45+
tag: ${{ inputs.tag }}
46+
47+
# jscpd:ignore-start
48+
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f24ce3360a8abf9bf386a62ab13d0ae5de5f9d13 # 0.31.7
49+
if: always() && steps.local-workflow-actions.outputs.repository
50+
with:
51+
actions-path: actions
52+
repository: ${{ steps.local-workflow-actions.outputs.repository }}
53+
ref: ${{ steps.local-workflow-actions.outputs.ref }}
54+
# jscpd:ignore-end
55+
cancel:
56+
if: ${{ inputs.publish }}
57+
name: Cancel release
58+
runs-on: ${{ fromJson(inputs.runs-on) }}
59+
permissions:
60+
contents: write
61+
steps:
62+
- env:
63+
GH_TOKEN: ${{ github.token }}
64+
GH_REPO: ${{ github.repository }}
65+
shell: bash
66+
run: gh release delete "${{ inputs.tag }}" --cleanup-tag --yes

.github/workflows/release-start.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<!-- header:start -->
2+
3+
# GitHub Workflow: Release - Start
4+
5+
<div align="center">
6+
<img src="../logo.svg" width="60px" align="center" alt="Release" />
7+
</div>
8+
9+
---
10+
11+
<!-- header:end -->
12+
<!-- badges:start -->
13+
14+
[![Release](https://img.shields.io/github/v/release/hoverkraft-tech/ci-github-publish)](https://github.com/hoverkraft-tech/ci-github-publish/releases)
15+
[![License](https://img.shields.io/github/license/hoverkraft-tech/ci-github-publish)](http://choosealicense.com/licenses/mit/)
16+
[![Stars](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-publish?style=social)](https://img.shields.io/github/stars/hoverkraft-tech/ci-github-publish?style=social)
17+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/hoverkraft-tech/ci-github-publish/blob/main/CONTRIBUTING.md)
18+
19+
<!-- badges:end -->
20+
<!-- overview:start -->
21+
22+
## Overview
23+
24+
Reusable release workflow
25+
This workflow delegates release tasks by reusing a shared release workflow, ensuring standardized publishing across projects.
26+
27+
### Permissions
28+
29+
- **`contents`**: `write`
30+
- **`id-token`**: `write`
31+
- **`pull-requests`**: `read`
32+
33+
<!-- overview:end -->
34+
<!-- usage:start -->
35+
36+
## Usage
37+
38+
```yaml
39+
name: Release
40+
on:
41+
push:
42+
branches:
43+
- main
44+
permissions: {}
45+
jobs:
46+
release:
47+
uses: hoverkraft-tech/ci-github-publish/.github/workflows/release-start.yml@84e8ace407055e7a40ba6670a8c697e1ce2dfafa # 0.20.1
48+
permissions: {}
49+
with:
50+
# JSON array of runner(s) to use.
51+
# See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job.
52+
#
53+
# Default: `["ubuntu-latest"]`
54+
runs-on: '["ubuntu-latest"]'
55+
56+
# Whether to mark the release as a prerelease
57+
# See ../../actions/release/create/README.md for more information.
58+
prerelease: false
59+
```
60+
61+
<!-- usage:end -->
62+
<!-- inputs:start -->
63+
64+
## Inputs
65+
66+
### Workflow Dispatch Inputs
67+
68+
| **Input** | **Description** | **Required** | **Type** | **Default** |
69+
| ---------------- | ---------------------------------------------------------------------------------- | ------------ | ----------- | ------------------- |
70+
| **`runs-on`** | JSON array of runner(s) to use. | **false** | **string** | `["ubuntu-latest"]` |
71+
| | See <https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job>. | | | |
72+
| **`prerelease`** | Whether to mark the release as a prerelease | **false** | **boolean** | `false` |
73+
| | See ../../actions/release/create/README.md for more information. | | | |
74+
75+
<!-- inputs:end -->
76+
<!-- secrets:start -->
77+
<!-- secrets:end -->
78+
<!-- outputs:start -->
79+
<!-- outputs:end -->
80+
<!-- examples:start -->
81+
<!-- examples:end -->
82+
<!-- contributing:start -->
83+
84+
## Contributing
85+
86+
Contributions are welcome! Please see the [contributing guidelines](https://github.com/hoverkraft-tech/ci-github-publish/blob/main/CONTRIBUTING.md) for more details.
87+
88+
<!-- contributing:end -->
89+
<!-- security:start -->
90+
<!-- security:end -->
91+
<!-- license:start -->
92+
93+
## License
94+
95+
This project is licensed under the MIT License.
96+
97+
SPDX-License-Identifier: MIT
98+
99+
Copyright © 2026 hoverkraft-tech
100+
101+
For more details, see the [license](http://choosealicense.com/licenses/mit/).
102+
103+
<!-- license:end -->
104+
<!-- generated:start -->
105+
106+
---
107+
108+
This documentation was automatically generated by [CI Dokumentor](https://github.com/hoverkraft-tech/ci-dokumentor).
109+
110+
<!-- generated:end -->
Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
1-
# Reusable release workflow
2-
# This workflow delegates release tasks by reusing a shared release workflow, ensuring standardized publishing across projects.
1+
# Reusable release workflow — creates a draft release and outputs the tag.
2+
# Pair with release-finish.yml to publish or delete the draft after running your own gate.
33
---
4-
name: Release
4+
name: Release - Start
55

66
on:
7+
workflow_call:
8+
inputs:
9+
runs-on:
10+
description: |
11+
JSON array of runner(s) to use.
12+
See https://docs.github.com/en/actions/using-jobs/choosing-the-runner-for-a-job.
13+
type: string
14+
default: '["ubuntu-latest"]'
15+
required: false
16+
prerelease:
17+
description: |
18+
Whether to mark the release as a prerelease.
19+
See ../../actions/release/create/README.md for more information.
20+
type: boolean
21+
default: false
22+
required: false
23+
outputs:
24+
tag:
25+
description: "The tag of the draft release."
26+
value: ${{ jobs.release.outputs.tag }}
727
workflow_dispatch:
828
inputs:
929
#checkov:skip=CKV_GHA_7: required
@@ -16,7 +36,7 @@ on:
1636
required: false
1737
prerelease:
1838
description: |
19-
Whether to mark the release as a prerelease
39+
Whether to mark the release as a prerelease.
2040
See ../../actions/release/create/README.md for more information.
2141
type: boolean
2242
default: false
@@ -59,6 +79,7 @@ jobs:
5979
prerelease: ${{ inputs.prerelease }}
6080
working-directory: ${{ inputs.working-directory }}
6181
include-paths: ${{ inputs.include-paths }}
82+
publish: false
6283

6384
# jscpd:ignore-start
6485
- uses: hoverkraft-tech/ci-github-common/actions/local-workflow-actions@f5847cb398fe65d53794e6aba98ebdfa0801f691 # 0.32.0

0 commit comments

Comments
 (0)