checks if version tag exists
- Store the version you need to validate in a file (eg.
.version
) - Trigger
validate-version-action
and pass all required inputs - Read out values from the outputs
version_filename
(default: '.version') - Path to the file with application versiongithub_token
- Pass the secrets.GITHUB_TOKEN variablefail_on_error
(default: 'false') - Fail the pipeline on version validation error
planned_version
- Version from version fileversion_file_exists
- False if version file doesn't existtag_hash
- Commit hash if version tag existscan_create
- True if version tag can be createdtag_exists
- True if version tag already existsbranch_name
- Working branch name
echo "1.0.0" > "${REPO_ROOT}/.version"
---
name: Release
on:
push:
branches:
- "*"
jobs:
validate_new_version:
name: Validate new version
runs-on: ubuntu-latest
outputs:
planned_version: ${{ steps.validate_new_version.outputs.planned_version }}
version_file_exists: ${{ steps.validate_new_version.outputs.version_file_exists }}
tag_hash: ${{ steps.validate_new_version.outputs.tag_hash }}
can_create: ${{ steps.validate_new_version.outputs.can_create }}
tag_exists: ${{ steps.validate_new_version.outputs.tag_exists }}
branch_name: ${{ steps.validate_new_version.outputs.branch_name }}
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Validate new version
id: validate_new_version
uses: reinvented-stuff/[email protected]
with:
version_filename: ".version"
github_token: "${{secrets.GITHUB_TOKEN}}"
fail_on_error: true
...