Added a tagrequested output for rollback purposes.

This commit is contained in:
Corey Butler 2020-04-01 22:19:36 -05:00
parent 862d691cac
commit 524efb95f2
4 changed files with 10 additions and 6 deletions

View File

@ -26,7 +26,7 @@ jobs:
if: success() && ${{ steps.autotagger.outputs.tagcreated }} = "yes"
uses: author/action-rollback@master
with:
tag: ${{ steps.autotagger.outputs.tagname }}
tag: ${{ steps.autotagger.outputs.tagrequested }}
delete_orphan_tag: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -40,7 +40,7 @@ jobs:
# If the version has changed, create a new git tag for it.
- name: Tag
id: autotagger
id: docker_autotagger
uses: butlerlogic/action-autotag@master
with:
strategy: docker
@ -49,10 +49,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Rollback Release
if: success() && ${{ steps.autotagger.outputs.tagcreated }} = "yes"
if: success() && ${{ steps.docker_autotagger.outputs.tagcreated }} = "yes"
uses: author/action-rollback@master
with:
tag: ${{ steps.autotagger.outputs.tagname }}
tag: ${{ steps.docker_autotagger.outputs.tagrequested }}
delete_orphan_tag: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -156,6 +156,7 @@ If you are building an action that runs after this one, be aware this action pro
1. `taguri`: The URI/URL of the new tag reference.
1. `tagmessage`: The messge applied to the tag reference (this is what shows up on the tag screen on Github).
1. `tagcreated`: `yes` or `no`.
1. `tagrequested`: The name of the requested tag. This will be populated even if the tag is not created. This will usually be the same as `tagname` and/or `version` for successful executions.
1. `version` will be the version attribute found in the `package.json` file.
---

View File

@ -40,10 +40,12 @@ outputs:
description: The URI/URL of the new tag reference.
tagmessage:
description: The messge applied to the tag reference (this is what shows up on the tag screen on Github).
version:
description: The version, as defined in package.json or explicitly set in the input.
tagcreated:
description: A "yes" or "no", indicating a new tag was created.
tagrequested:
description: The name of the requested tag. This will be populated even if the tag is not created.
version:
description: The version, as defined in package.json or explicitly set in the input.
runs:
using: 'docker'
image: 'Dockerfile'

View File

@ -52,6 +52,7 @@ async function run () {
)
core.warning(`Attempting to create ${tag.name} tag.`)
core.setOutput('tagrequested', tag.name)
// Check for existance of tag and abort (short circuit) if it already exists.
if (await tag.exists()) {