-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a5de726
Showing
8 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false | ||
|
||
[VERSION] | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Create new pre-release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set build version number | ||
run: | | ||
echo VERSION=$(cat VERSION).$GITHUB_RUN_NUMBER >> $GITHUB_ENV | ||
- name: Create GitHub pre-release | ||
uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: v${{ env.VERSION }} | ||
prerelease: true | ||
title: ${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: [released] | ||
workflow_dispatch: | ||
inputs: | ||
TAG_NAME: | ||
description: "Tag name that the major tag will point to" | ||
required: true | ||
|
||
env: | ||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update_tag: | ||
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes | ||
environment: | ||
name: releaseNewActionVersion | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update the ${{ env.TAG_NAME }} tag | ||
id: update-major-tag | ||
uses: actions/publish-action@v0.1.0 | ||
with: | ||
source-tag: ${{ env.TAG_NAME }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 GeoWerkstatt GmbH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# create-jira-release (GitHub Action) | ||
|
||
[![Release](https://github.com/GeoWerkstatt/create-jira-release/actions/workflows/release-new-action-version.yml/badge.svg)](https://github.com/GeoWerkstatt/create-jira-release/actions/workflows/release-new-action-version.yml) | ||
|
||
Creates a new Jira release for a specific Jira project and assigns all relevant* Jira issue numbers to it. | ||
\* All Jira issue numbers (e.g. TEST-123) in commit messages since last Git tag. | ||
|
||
## Prerequisites | ||
|
||
In order to be able to use this GitHub Action, a custom Jira automation rule needs to be created first. Please refer to the screenshot below for the most important settings. | ||
|
||
![Setup Jira automation rule](./setup-jira-automation-rule.png) | ||
|
||
## Usage | ||
|
||
See [action.yml](action.yml) | ||
|
||
```yaml | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: GeoWerkstatt/create-jira-release@v1 | ||
with: | ||
jira-project-key: 'TEST' | ||
jira-automation-webhook: ${{ secrets.JIRA_AUTOMATION_WEBHOOK }} | ||
build-version: v${{ env.VERSION }} | ||
``` | ||
## Options | ||
| key | description | required | | ||
| ------------------------- | ------------------------------------- | -------- | | ||
| `jira-project-key` | Jira project identifier (e.g. _TEST_) | true | | ||
| `jira-automation-webhook` | Jira automation webhook url | true | | ||
| `build-version` | Version identifier | true | | ||
|
||
## Secrets | ||
|
||
| key | description | required | | ||
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -------- | | ||
| `secrets.JIRA_AUTOMATION_WEBHOOK` | Can be obtained or regenerated in the _Incoming webhook_ automation step of the corresponding Jira automation rule. | true | | ||
|
||
## Publish new GitHub Action version | ||
|
||
A new GitHub _pre-release_ is created [automatically](./.github/workflows/create-new-pre-release.yml) if there are new changes on the `main` branch. Uncheck _This is a pre-release_ in the _Edit_-Section for a specific pre-release in order to [update](./.github/workflows/release-new-action-version.yml) a major tag (e.g. v1) to point to the latest release. A major tag from the latest released tag is created automatically if a corresponding major tag doesn't exist already. | ||
|
||
## License | ||
|
||
The scripts and documentation in this project are released under the [MIT License](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: "Jira Release Web Hook" | ||
description: "Creates a new Jira release and assigns all relevant issues to it." | ||
inputs: | ||
jira-project-key: | ||
description: "Jira project identifier" | ||
required: true | ||
jira-automation-webhook: | ||
description: "Jira automation webhook url" | ||
required: true | ||
build-version: | ||
description: "Version identifier" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Fetch entire Git history (including tags) | ||
run: git fetch --prune --unshallow --tags | ||
shell: bash | ||
|
||
- name: Collect issue numbers since last release/tag | ||
run: | | ||
export LC_ALL=en_US.utf8 | ||
git log $(git describe --abbrev=0 2> /dev/null || git rev-list --max-parents=0 HEAD)..HEAD | \ | ||
grep -oP "${{ inputs.jira-project-key }}-\d{1,}" | sort | uniq | \ | ||
sed 's/^\|$/"/g' | paste -sd , | awk '{print "RELATED_JIRA_ISSUES="$0}' >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Create json and invoke webhook | ||
run: | | ||
$json = ConvertTo-Json @{issues = @(${{ env.RELATED_JIRA_ISSUES }}); data = @{version = "${{ inputs.build-version }}"; projectName = "${{ inputs.jira-project-key }}"}} | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
Invoke-RestMethod ${{ inputs.jira-automation-webhook }} -Method Post -Body $json -ContentType "application/json" | ||
shell: pwsh |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.