checks if version tag exists
- Store the version you need to validate in a file (eg.
.version) - Trigger
validate-version-actionand 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: Releaseon:
push:
branches:
- "*"jobs:
validate_new_version:
name: Validate new versionruns-on: ubuntu-latestoutputs:
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 codeuses: actions/checkout@v2with:
fetch-depth: 0
- name: Validate new versionid: validate_new_versionuses: reinvented-stuff/validate-version-action@1.1.4with:
version_filename: ".version"github_token: "${{secrets.GITHUB_TOKEN}}"fail_on_error: true
...