From 40da6c43e1143bd67d36a16ac2bbb9c687b737e6 Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 30 Oct 2019 14:34:57 +0100 Subject: [PATCH 01/15] Test entrypoint update --- .idea/.gitignore | 3 +++ .idea/github-create-release-action.iml | 8 ++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ entrypoint.sh | 11 +---------- 6 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/github-create-release-action.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..0e40fe8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ + +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/.idea/github-create-release-action.iml b/.idea/github-create-release-action.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/github-create-release-action.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..8d367c1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index dc60341..e18dfd1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,15 +1,6 @@ #!/bin/sh # Backwards compability mapping -if [ -z $VERSION_REGEX ]; then :; else - INPUT_VERSION_REGEX=$VERSION_REGEX -fi -if [ -z $PRERELEASE_REGEX ]; then :; else - INPUT_PRERELEASE_REGEX=$PRERELEASE_REGEX -fi -if [ -z $DRAFT ]; then :; else - INPUT_CREATE_DRAFT=$DRAFT -fi if [ -z $UPDATE_EXISTING ]; then :; else INPUT_UPDATE_EXISTING=$UPDATE_EXISTING fi @@ -46,7 +37,7 @@ create_release_data() { RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --argjson value $PRERELEASE_VALUE '.prerelease = $value') } -TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)" +TAG=${CREATED_TAG} if [ -z $TAG ]; then echo "This is not a tagged push." 1>&2 From 35e397f46b6ec9cae07253d2d5119642f2d26bc3 Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 30 Oct 2019 16:32:18 +0100 Subject: [PATCH 02/15] Update readme --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c680bb..1ec12cc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # GitHub Action for Creating a Release on Tag push -Create a new GitHub release whenever a tag is pushed. +Forked since the tag creation is done by another action and just passed +to this action in the same workflow (workaround since 1 workflow/action +can not trigger another workflow/action). + +Creates a new GitHub release whenever a tag is pushed. ## Example Usage @@ -19,6 +23,7 @@ jobs: version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CREATED_TAG: *premade tag* ``` ### Limiting versions and creating pre-releases From a97177cf72f305f2a38eb4d0718b709865724f60 Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 20 Nov 2019 16:26:53 +0100 Subject: [PATCH 03/15] Cleanup passable tag, Update readme, Update action.yml --- README.md | 39 ++++++++++++++++++++++++++++++++++----- action.yml | 4 ++++ entrypoint.sh | 12 +++++++++++- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1ec12cc..269a343 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # GitHub Action for Creating a Release on Tag push -Forked since the tag creation is done by another action and just passed -to this action in the same workflow (workaround since 1 workflow/action -can not trigger another workflow/action). - Creates a new GitHub release whenever a tag is pushed. ## Example Usage @@ -23,7 +19,6 @@ jobs: version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CREATED_TAG: *premade tag* ``` ### Limiting versions and creating pre-releases @@ -45,6 +40,40 @@ Regular expressions containing `\` need them to be escaped with `\\`. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` +### Passing a tag to not rely on manual tag pushes + +If you want to create a tag automatically and create the release in the same workflow you can set CREATED_TAG to achieve this. +This allows you to create a fully automated release in one workflow file (workaround because one workflow/action can not trigger another workflow/action). +The example below uses K-Phoen/semver-release-action to create the tag whenever a pull request is closed, merged, and the head_ref starts with RC. +After the tag is created it is passed to the create-release-action via the CREATED_TAG env variable using the output of the semver-release-action. + +```yaml +on: + pull_request: + types: closed + +jobs: + build: + runs-on: ubuntu-latest + if: github.event.pull_request.merged && startsWith(github.head_ref, 'RC') + steps: + - uses: actions/checkout@master + - name: Tag and prepare release + id: tag_and_prepare_release + uses: K-Phoen/semver-release-action@master + with: + release_branch: master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload release notes + if: steps.tag_and_prepare_release.outputs.tag + uses: Roang-zero1/github-create-release-action@master + with: + created_tag: ${{ steps.tag_and_prepare_release.outputs.tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +``` + ### Changelog parsing This action makes it possible to extract the release description from a Markdown changelog. diff --git a/action.yml b/action.yml index d9f1e4a..6e7058d 100644 --- a/action.yml +++ b/action.yml @@ -22,6 +22,10 @@ inputs: description: 'Controls whether an existing release should be updated with data from the latest push (true|false [default: false]).' default: 'false' required: false + created_tag: + description: 'Allows to pass an already created tag, forces update_existing to true.' + default: 'false' + required: false # Inputs related to the Changelog parsing changelog_file: diff --git a/entrypoint.sh b/entrypoint.sh index e18dfd1..163e423 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,6 +13,16 @@ fi set -euo pipefail +set_tag() { +if [ "${INPUT_CREATED_TAG}" == false ]; +then +TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)"; +else +TAG=${INPUT_CREATED_TAG}; +INPUT_UPDATE_EXISTING="true" +fi +} + create_release_data() { RELEASE_DATA="{}" RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --arg tag $TAG '.tag_name = $tag') @@ -37,7 +47,7 @@ create_release_data() { RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --argjson value $PRERELEASE_VALUE '.prerelease = $value') } -TAG=${CREATED_TAG} +set_tag if [ -z $TAG ]; then echo "This is not a tagged push." 1>&2 From 937702acf1b329e08b466da3022b5a94707cf300 Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 20 Nov 2019 16:29:27 +0100 Subject: [PATCH 04/15] Remove IDE settings, Add gitignore --- .gitignore | 4 ++++ .idea/.gitignore | 3 --- .idea/github-create-release-action.iml | 8 -------- .idea/misc.xml | 6 ------ .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ .vscode/settings.json | 18 ------------------ 7 files changed, 4 insertions(+), 49 deletions(-) create mode 100644 .gitignore delete mode 100644 .idea/.gitignore delete mode 100644 .idea/github-create-release-action.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..25022b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Intellij settings +.idea +# VScode settings +.vscode \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 0e40fe8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -# Default ignored files -/workspace.xml \ No newline at end of file diff --git a/.idea/github-create-release-action.iml b/.idea/github-create-release-action.iml deleted file mode 100644 index c956989..0000000 --- a/.idea/github-create-release-action.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 28a804d..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 8d367c1..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 272be54..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "spellright.language": [ - "en_GB" - ], - "spellright.documentTypes": [ - "markdown", - "latex", - "plaintext", - "git-commit", - "shellscript", - "github-actions" - ], - "spellright.parserByClass": { - "github-actions": { - "parser": "code" - } - } -} \ No newline at end of file From f9af345082d193eb16e93a202303aa4fa24b6f9a Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 20 Nov 2019 16:34:12 +0100 Subject: [PATCH 05/15] Revert removed backwards compatibility mapping --- entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 163e423..d2209e0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,15 @@ #!/bin/sh # Backwards compability mapping +if [ -z $VERSION_REGEX ]; then :; else + INPUT_VERSION_REGEX=$VERSION_REGEX +fi +if [ -z $PRERELEASE_REGEX ]; then :; else + INPUT_PRERELEASE_REGEX=$PRERELEASE_REGEX +fi +if [ -z $DRAFT ]; then :; else + INPUT_CREATE_DRAFT=$DRAFT +fi if [ -z $UPDATE_EXISTING ]; then :; else INPUT_UPDATE_EXISTING=$UPDATE_EXISTING fi From 8c354df5ad987b7941d964956b1fb23593785cfc Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 20 Nov 2019 16:35:07 +0100 Subject: [PATCH 06/15] Fix typo --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index d2209e0..4fe42e6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -23,7 +23,7 @@ fi set -euo pipefail set_tag() { -if [ "${INPUT_CREATED_TAG}" == false ]; +if [ "${INPUT_CREATED_TAG}" == "false" ]; then TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)"; else From ea6cbb2306aecbbbef4f8f2b054d019ac6ea5773 Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 20 Nov 2019 16:42:28 +0100 Subject: [PATCH 07/15] Update readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 269a343..07cde07 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,10 @@ Controls whether an existing release should be updated with data from the latest File that contains the Markdown formatted changelog. Defaults to `CHANGELOG.md`. +### `created_tag` + +Allows to pass an already created tag, forces update_existing to true. + ### `changelog_heading` Heading level at which the tag headings exist. Defaults to `h2`, this parses headings at the markdown level `##`. From 50c12bcce70cbbb36494f074282bcc7932b04495 Mon Sep 17 00:00:00 2001 From: serucee Date: Wed, 20 Nov 2019 16:42:58 +0100 Subject: [PATCH 08/15] Update readme --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 07cde07..fac1ae7 100644 --- a/README.md +++ b/README.md @@ -113,14 +113,14 @@ Create the releases as draft (`true|false [default: false]`). Existing will not Controls whether an existing release should be updated with data from the latest push (`true|false [default: false]`). -### `changelog_file` - -File that contains the Markdown formatted changelog. Defaults to `CHANGELOG.md`. - ### `created_tag` Allows to pass an already created tag, forces update_existing to true. +### `changelog_file` + +File that contains the Markdown formatted changelog. Defaults to `CHANGELOG.md`. + ### `changelog_heading` Heading level at which the tag headings exist. Defaults to `h2`, this parses headings at the markdown level `##`. From 3f34d38bf995ffaa60adbab841e2a9f0327f928b Mon Sep 17 00:00:00 2001 From: Sebastian Russmann <43376129+serucee@users.noreply.github.com> Date: Wed, 4 Dec 2019 14:23:39 +0100 Subject: [PATCH 09/15] Add passable release title * Add title optional * Update action.yml * Fix title for release * Fix release name * Move title * Test * test * fix entrypoint.sh * test * Cleanup code, Update doc --- README.md | 4 ++++ action.yml | 4 ++++ entrypoint.sh | 14 +++++++++++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fac1ae7..d220074 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,10 @@ Controls whether an existing release should be updated with data from the latest Allows to pass an already created tag, forces update_existing to true. +### `release_title` + +Allows to pass a release title. + ### `changelog_file` File that contains the Markdown formatted changelog. Defaults to `CHANGELOG.md`. diff --git a/action.yml b/action.yml index 6e7058d..e8797eb 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,10 @@ inputs: description: 'Allows to pass an already created tag, forces update_existing to true.' default: 'false' required: false + release_title: + description: 'Allows to pass a title for the release.' + default: 'false' + required: false # Inputs related to the Changelog parsing changelog_file: diff --git a/entrypoint.sh b/entrypoint.sh index 4fe42e6..8e29f17 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -25,16 +25,24 @@ set -euo pipefail set_tag() { if [ "${INPUT_CREATED_TAG}" == "false" ]; then -TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)"; + TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)"; else -TAG=${INPUT_CREATED_TAG}; -INPUT_UPDATE_EXISTING="true" + TAG=${INPUT_CREATED_TAG}; + INPUT_UPDATE_EXISTING="true" +fi +} + +set_release_title() { +if [ "${INPUT_RELEASE_TITLE}" != "false" ]; +then + RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --arg name "${INPUT_RELEASE_TITLE}" '.name = $name') fi } create_release_data() { RELEASE_DATA="{}" RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --arg tag $TAG '.tag_name = $tag') + set_release_title if [ -e $INPUT_CHANGELOG_FILE ]; then RELEASE_BODY=$(submark -O --$INPUT_CHANGELOG_HEADING $TAG $INPUT_CHANGELOG_FILE) if [ -n "${RELEASE_BODY}" ]; then From 12fb7888dc1dbe6b1eab10e4a40b492f903deb66 Mon Sep 17 00:00:00 2001 From: Lucas Brandstaetter Date: Fri, 6 Dec 2019 21:49:39 +0100 Subject: [PATCH 10/15] Restore vscode settings --- .gitignore | 2 -- .vscode/settings.json | 19 +++++++++++++++++++ action.yml | 44 +++++++++++++++++++++---------------------- 3 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 25022b1..07d0be4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ # Intellij settings .idea -# VScode settings -.vscode \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4db65cc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,19 @@ +{ + "spellright.language": [ + "en_GB" + ], + "spellright.documentTypes": [ + "markdown", + "latex", + "plaintext", + "git-commit", + "shellscript", + "github-actions" + ], + "spellright.parserByClass": { + "github-actions": { + "parser": "code" + } + }, + "editor.formatOnSave": true +} diff --git a/action.yml b/action.yml index e8797eb..d2229a5 100644 --- a/action.yml +++ b/action.yml @@ -1,45 +1,45 @@ # action.yml -name: 'GitHub Create Tag Release' -description: 'Create a GitHub release from a pushed Tag.' +name: "GitHub Create Tag Release" +description: "Create a GitHub release from a pushed Tag." branding: - icon: 'zap' - color: 'white' + icon: "zap" + color: "white" inputs: # Version and release control inputs version_regex: - description: 'Regular expression to verify that the version is in a correct format. Defaults to .* (accept everything).' - default: '^.*$' + description: "Regular expression to verify that the version is in a correct format. Defaults to .* (accept everything)." + default: "^.*$" required: false prerelease_regex: - description: 'Any version matching this regular expression will be marked as pre-release. Disabled by default.' - default: '' + description: "Any version matching this regular expression will be marked as pre-release. Disabled by default." + default: "" required: false create_draft: - description: 'Create the releases as draft (true|false [default: false]). Existing will not be updated from released to draft.' - default: 'false' + description: "Create the releases as draft (true|false [default: false]). Existing will not be updated from released to draft." + default: "false" required: false update_existing: - description: 'Controls whether an existing release should be updated with data from the latest push (true|false [default: false]).' - default: 'false' + description: "Controls whether an existing release should be updated with data from the latest push (true|false [default: false])." + default: "false" required: false created_tag: - description: 'Allows to pass an already created tag, forces update_existing to true.' - default: 'false' + description: "Allows to pass an already created tag, forces update_existing to true." + default: "false" required: false release_title: - description: 'Allows to pass a title for the release.' - default: 'false' + description: "Allows to pass a title for the release." + default: "false" required: false # Inputs related to the Changelog parsing changelog_file: - description: 'Path of file that contains the Markdown formatted changelog.' - default: 'CHANGELOG.md' + description: "Path of file that contains the Markdown formatted changelog." + default: "CHANGELOG.md" required: false changelog_heading: - description: 'Heading level at which the tag headings exist.' - default: 'h2' + description: "Heading level at which the tag headings exist." + default: "h2" required: false runs: - using: 'docker' - image: 'Dockerfile' + using: "docker" + image: "Dockerfile" From 62bb335352ba1e2b298f555b8b9d43674ef81cfb Mon Sep 17 00:00:00 2001 From: Lucas Brandstaetter Date: Fri, 6 Dec 2019 22:22:00 +0100 Subject: [PATCH 11/15] Update release_title input * Merge set_release_title and create_release_data as they both deal with the release JSON. * Use empty string for release_title as false may be an allowed value. --- action.yml | 2 +- entrypoint.sh | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index d2229a5..1455199 100644 --- a/action.yml +++ b/action.yml @@ -28,7 +28,7 @@ inputs: required: false release_title: description: "Allows to pass a title for the release." - default: "false" + default: "" required: false # Inputs related to the Changelog parsing diff --git a/entrypoint.sh b/entrypoint.sh index 8e29f17..208ca1a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,17 +32,9 @@ else fi } -set_release_title() { -if [ "${INPUT_RELEASE_TITLE}" != "false" ]; -then - RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --arg name "${INPUT_RELEASE_TITLE}" '.name = $name') -fi -} - create_release_data() { RELEASE_DATA="{}" RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --arg tag $TAG '.tag_name = $tag') - set_release_title if [ -e $INPUT_CHANGELOG_FILE ]; then RELEASE_BODY=$(submark -O --$INPUT_CHANGELOG_HEADING $TAG $INPUT_CHANGELOG_FILE) if [ -n "${RELEASE_BODY}" ]; then @@ -62,6 +54,9 @@ create_release_data() { fi fi RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --argjson value $PRERELEASE_VALUE '.prerelease = $value') + if [ -n "${INPUT_RELEASE_TITLE}" ]; then + RELEASE_DATA=$(echo ${RELEASE_DATA} | jq --arg name "${INPUT_RELEASE_TITLE}" '.name = $name') + fi } set_tag From 24330623624491d7a4be53a3e21a23db68a78a0a Mon Sep 17 00:00:00 2001 From: Lucas Brandstaetter Date: Fri, 6 Dec 2019 22:09:00 +0100 Subject: [PATCH 12/15] Fix typo --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 208ca1a..75adfce 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Backwards compability mapping +# Backwards compatibility mapping if [ -z $VERSION_REGEX ]; then :; else INPUT_VERSION_REGEX=$VERSION_REGEX fi From a0b127f2bd0e8cdd46e1fe49e4b9a7d1369cabc7 Mon Sep 17 00:00:00 2001 From: Lucas Brandstaetter Date: Fri, 6 Dec 2019 22:16:48 +0100 Subject: [PATCH 13/15] Update created_tag * Use empty string as default value. * Re-format function. --- action.yml | 2 +- entrypoint.sh | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/action.yml b/action.yml index 1455199..8dc298f 100644 --- a/action.yml +++ b/action.yml @@ -24,7 +24,7 @@ inputs: required: false created_tag: description: "Allows to pass an already created tag, forces update_existing to true." - default: "false" + default: "" required: false release_title: description: "Allows to pass a title for the release." diff --git a/entrypoint.sh b/entrypoint.sh index 75adfce..8082e61 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -23,13 +23,12 @@ fi set -euo pipefail set_tag() { -if [ "${INPUT_CREATED_TAG}" == "false" ]; -then - TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)"; -else - TAG=${INPUT_CREATED_TAG}; - INPUT_UPDATE_EXISTING="true" -fi + if [ -n "${INPUT_CREATED_TAG}" ]; then + TAG=${INPUT_CREATED_TAG} + INPUT_UPDATE_EXISTING="true" + else + TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)" + fi } create_release_data() { From f0ceade55349c10fab49e29b7aaf2756b3263661 Mon Sep 17 00:00:00 2001 From: Lucas Brandstaetter Date: Fri, 6 Dec 2019 22:38:40 +0100 Subject: [PATCH 14/15] Update entrypoint.sh * Remove forced update in created_tag. --- entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 8082e61..ce9b317 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -25,7 +25,6 @@ set -euo pipefail set_tag() { if [ -n "${INPUT_CREATED_TAG}" ]; then TAG=${INPUT_CREATED_TAG} - INPUT_UPDATE_EXISTING="true" else TAG="$(echo ${GITHUB_REF} | grep tags | grep -o "[^/]*$" || true)" fi From 82c38e96bdb32209476f683ab447c2321f45b978 Mon Sep 17 00:00:00 2001 From: Lucas Brandstaetter Date: Fri, 6 Dec 2019 22:43:27 +0100 Subject: [PATCH 15/15] Update README --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d220074..3fdd6fb 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,12 @@ jobs: release: runs-on: ubuntu-latest steps: - - name: Create GitHub release - uses: Roang-zero1/github-create-release-action@master - with: - version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create GitHub release + uses: Roang-zero1/github-create-release-action@master + with: + version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` ### Limiting versions and creating pre-releases @@ -27,8 +27,8 @@ If only certain tags should create releases or some releases should be created a These regular expression are evaluated with GNU grep, so these regular expressions need to be compatible with it. Regular expressions containing `\` need them to be escaped with `\\`. -* `version_regex` Regular expression to verify that the version is in a correct format. Defaults to `.*` (accept everything). -* `prerelease_regex` Any version matching this regular expression will be marked as pre-release. Disabled by default. +- `version_regex` Regular expression to verify that the version is in a correct format. Defaults to `.*` (accept everything). +- `prerelease_regex` Any version matching this regular expression will be marked as pre-release. Disabled by default. ```yaml - name: Create GitHub release @@ -44,7 +44,7 @@ Regular expressions containing `\` need them to be escaped with `\\`. If you want to create a tag automatically and create the release in the same workflow you can set CREATED_TAG to achieve this. This allows you to create a fully automated release in one workflow file (workaround because one workflow/action can not trigger another workflow/action). -The example below uses K-Phoen/semver-release-action to create the tag whenever a pull request is closed, merged, and the head_ref starts with RC. +The example below uses `K-Phoen/semver-release-action` to create the tag whenever a pull request is closed, merged, and the head_ref starts with RC. After the tag is created it is passed to the create-release-action via the CREATED_TAG env variable using the output of the semver-release-action. ```yaml @@ -115,7 +115,7 @@ Controls whether an existing release should be updated with data from the latest ### `created_tag` -Allows to pass an already created tag, forces update_existing to true. +Allows to pass an already created tag. ### `release_title` @@ -131,4 +131,4 @@ Heading level at which the tag headings exist. Defaults to `h2`, this parses hea ## Secrets -* `GITHUB_TOKEN` Provided by GitHub action, does not need to be set. +- `GITHUB_TOKEN` Provided by GitHub action, does not need to be set.