https://github.com/f2calv/gha-check-release-exists
GitHub Action to check if a release tag exists (i.e. before attempting to publish)
https://github.com/f2calv/gha-check-release-exists
github-action
Last synced: about 1 year ago
JSON representation
GitHub Action to check if a release tag exists (i.e. before attempting to publish)
- Host: GitHub
- URL: https://github.com/f2calv/gha-check-release-exists
- Owner: f2calv
- License: mit
- Created: 2022-11-15T04:54:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-17T18:56:44.000Z (about 2 years ago)
- Last Synced: 2025-01-26T07:46:47.110Z (over 1 year ago)
- Topics: github-action
- Language: PowerShell
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Action: Check Release Exists
This GitHub Action executes GitHub CLI and evaluates it's output to see if a release name exists in the current repository, with this information you can then determine whether or not to create a new release.
## Example
```yaml
steps:
#insert your automated versioning system/tool here, e.g. gitversion, etc...
- name: gitversion (1 of 2)
uses: gittools/actions/gitversion/setup@v1
with:
versionSpec: 5.x
- name: gitversion (2 of 2)
id: gitversion
uses: gittools/actions/gitversion/execute@v1
with:
useConfigFile: true
additionalArguments: /nofetch
- uses: f2calv/gha-check-release-exists@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ReleaseName: 1.2.3
#Note: ideally pass in the desired release name from another action output
#ReleaseName: ${{ steps.gitversion.outputs.semVer }}
#insert your build steps here, e.g. nuget, container, etc...
#push package/create release
- name: dotnet push (api.nuget.org)
shell: bash
run: |
#dotnet nuget push ...
#docker push ...
#etc...
if: |
steps.check-release-exists.outputs.ReleaseExists == 'false'
&& (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event.inputs.PublishPreview == 'true')
```
## Inputs
- GITHUB_TOKEN, i.e. secrets.GITHUB_TOKEN
- ReleaseName, i.e. `1.2.2` or `1.2.2-2022-04-ci-updates.12`
## Outputs
- ReleaseExists, i.e. `True` or `False`