Skip to content

Commit 9eb60c1

Browse files
committed
feat(github-action): create GitHub Release Action
1 parent ad9a007 commit 9eb60c1

File tree

5 files changed

+69
-1
lines changed

5 files changed

+69
-1
lines changed

.github/workflows/main.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ jobs:
7272
releaseBranchRegExp: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:next|prerelease|rc))?$'
7373
- name: Create release
7474
if: github.event_name != 'pull_request' && github.event_name != 'merge_group'
75-
run: gh release create v${{ steps.newVersion.outputs.nextVersionTag }} --generate-notes ${{ contains( steps.newVersion.outputs.nextVersionTag, '-' ) && '--prerelease' || '' }} --target ${{ github.ref_name }}
75+
uses: ./tools/github-actions/release
76+
with:
77+
version: ${{ steps.newVersion.outputs.nextVersionTag }}
78+
target: ${{ github.ref_name }}
7679
env:
7780
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7881

tools/github-actions/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Actions currently available :
88
* Setup action [Documentation](setup/readme.md)
99
* Upload build output action [Documentation](upload-build-output/readme.md)
1010
* Download build output action [Documentation](download-build-output/readme.md)
11+
* New GitHub Release action [Documentation](release/readme.md)

tools/github-actions/release/LICENSE

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright Amadeus SAS
2+
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation and/or
11+
other materials provided with the distribution.
12+
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software without
15+
specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Create a new GitHub Release
2+
description: Creates a new GitHub Release for a given version
3+
inputs:
4+
version:
5+
description: 'The version to create the release for'
6+
required: true
7+
target:
8+
description: 'The branch to target'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Create release
14+
shell: bash
15+
run: gh release create v${{ inputs.version }} --generate-notes ${{ contains( inputs.version, '-' ) && '--prerelease' || '' }} --target ${{ inputs.target }}
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Create a new Github Release
2+
3+
## Overview
4+
5+
GitHub Action for creating a new release on GitHub.
6+
7+
> [!NOTE]
8+
> This action requires `contents: write` [permission](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token) in order to create the release.
9+
10+
## Task options
11+
12+
See [Action specifications](./action.yml) directly for more information about the supported parameters.
13+
14+
## Usage example
15+
16+
```yaml
17+
- name: Create release
18+
if: github.event_name != 'pull_request'
19+
uses: AmadeusITGroup/otter/tools/github-actions/release
20+
with:
21+
version: ${{ nextVersionTag }}
22+
target: ${{ github.ref_name }}
23+
```

0 commit comments

Comments
 (0)