Skip to content

Commit

Permalink
feat(github-action): create GitHub Release Action (AmadeusITGroup#2259)
Browse files Browse the repository at this point in the history
## Proposed change

## Related issues

- 🚀 Feature resolves AmadeusITGroup#2258
  • Loading branch information
vscaiceanu-1a authored Oct 15, 2024
2 parents 622a95c + 9eb60c1 commit b4c4ebb
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ jobs:
releaseBranchRegExp: 'release\/(0|[1-9]\d*)\.(0|[1-9]\d*)(\.0-(?:next|prerelease|rc))?$'
- name: Create release
if: github.event_name != 'pull_request' && github.event_name != 'merge_group'
run: gh release create v${{ steps.newVersion.outputs.nextVersionTag }} --generate-notes ${{ contains( steps.newVersion.outputs.nextVersionTag, '-' ) && '--prerelease' || '' }} --target ${{ github.ref_name }}
uses: ./tools/github-actions/release
with:
version: ${{ steps.newVersion.outputs.nextVersionTag }}
target: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
1 change: 1 addition & 0 deletions tools/github-actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Actions currently available :
* Setup action [Documentation](setup/readme.md)
* Upload build output action [Documentation](upload-build-output/readme.md)
* Download build output action [Documentation](download-build-output/readme.md)
* New GitHub Release action [Documentation](release/readme.md)
26 changes: 26 additions & 0 deletions tools/github-actions/release/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright Amadeus SAS

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 changes: 15 additions & 0 deletions tools/github-actions/release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Create a new GitHub Release
description: Creates a new GitHub Release for a given version
inputs:
version:
description: 'The version to create the release for'
required: true
target:
description: 'The branch to target'
required: true
runs:
using: "composite"
steps:
- name: Create release
shell: bash
run: gh release create v${{ inputs.version }} --generate-notes ${{ contains( inputs.version, '-' ) && '--prerelease' || '' }} --target ${{ inputs.target }}
23 changes: 23 additions & 0 deletions tools/github-actions/release/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Create a new Github Release

## Overview

GitHub Action for creating a new release on GitHub.

> [!NOTE]
> 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.
## Task options

See [Action specifications](./action.yml) directly for more information about the supported parameters.

## Usage example

```yaml
- name: Create release
if: github.event_name != 'pull_request'
uses: AmadeusITGroup/otter/tools/github-actions/release
with:
version: ${{ nextVersionTag }}
target: ${{ github.ref_name }}
```

0 comments on commit b4c4ebb

Please sign in to comment.