Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/author/action-rollback
A Github action to rollback/delete a release.
https://github.com/author/action-rollback
Last synced: 7 days ago
JSON representation
A Github action to rollback/delete a release.
- Host: GitHub
- URL: https://github.com/author/action-rollback
- Owner: author
- License: mit
- Created: 2020-01-29T16:32:24.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-24T15:51:34.000Z (21 days ago)
- Last Synced: 2025-01-01T07:04:58.094Z (14 days ago)
- Language: JavaScript
- Homepage:
- Size: 2.29 MB
- Stars: 57
- Watchers: 3
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - Rollback a GitHub Release
- fucking-awesome-actions - Rollback a GitHub Release
- awesome-workflows - Rollback a GitHub Release
README
# author/action-rollback
This action will rollback/delete a Github release. It is designed as a failsafe for workflows that do not complete, produce errors, fail to publish, or any other circumstance where removing a release is applicable.
For example, consider the lifecycle of a Javascript package being published to npm.
`test-->build-->tag-->release-->publish`
In the scenario where publishing fails, it may be desirable to rollback the release.
## Workflow
The following is an example `.github/publish.yml` that will rollback a release when a publish fails.
Configuring the action is straightforward:
```yaml
- name: Rollback Release
if: failure()
uses: author/action-rollback@stable
with:
# Using a known release ID
release_id: ${{ steps.create_release.id }}
# Using a tag name
tag: 'v1.0.1'
# If the release does not exist but the tag does, setting this to true will remove the tag.
delete_orphan_tag: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```It's a bit easier to understand in context of a complete workflow:
```yaml
name: Publishon:
push:
branches:
- masterpermissions: # You may need this permission for removing old releases
contents: writejobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Tag
id: autotagger
uses: butlerlogic/action-autotag@stable
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Release
id: create_release
if: steps.autotagger.outputs.tagname != ''
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.autotagger.outputs.tagname }}
release_name: Version ${{ steps.autotagger.outputs.version }}
body: ${{ steps.autotagger.outputs.tagmessage }}
draft: false
prerelease: true- name: Publish
id: publish_npm
if: steps.autotagger.outputs.tagname != ''
uses: author/action-publish@stable
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}- name: Rollback Release
if: failure() && steps.create_release.outputs.id != ''
uses: author/action-rollback@stable
with:
# Using a known release ID
id: ${{ steps.create_release.id }}
# Using a tag name
tag: ${{ steps.autotagger.outputs.tagname }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```Only the `id` _**or**_ `tag` need to be specified. If a publish fails, the release will be removed.
### What is the purpose of `delete_orphan_tag`?
It's a way to clean up messy processes.
It may seem unnecessary at first. However; it is useful when a release is removed through other means, leaving an orphan tag.
Technically, this attribute could be used if you only need to rollback tags of any kind (regardless of whether a release exists).
---
## CreditsThis action was written and is primarily maintained by [Corey Butler](https://github.com/coreybutler).
# Our Ask...
If you use this or find value in it, please consider contributing in one or more of the following ways:
1. Click the "Sponsor" button at the top of the page.
1. Star it!
1. [Tweet about it!](https://twitter.com/intent/tweet?hashtags=github,actions&original_referer=http%3A%2F%2F127.0.0.1%3A91%2F&text=I%20am%20automating%20my%20workflow%20with%20the%20Multipublisher%20Github%20action!&tw_p=tweetbutton&url=https%3A%2F%2Fgithub.com%2Fauthor%2Faction%2Fpublish&via=goldglovecb)
1. Fix an issue.
1. Add a feature (post a proposal in an issue first!).Copyright © 2020 Author.io, Corey Butler, and Contributors.