From 9baefd6dfa76f865cea83619ada7f6ff44543600 Mon Sep 17 00:00:00 2001 From: Santiago Bernhardt Date: Fri, 14 Jul 2023 14:26:24 +1200 Subject: [PATCH] feat: verify semver is valid inside the version_file + readme updates --- README.md | 25 ++++++++++++++----------- VERSION | 2 +- action.yml | 10 ++++++++++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ae93bd9..bcbe3f8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ jobs: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: fetch-depth: '0' @@ -40,27 +40,30 @@ jobs: echo "tar=some-tar.tar" >> "${GITHUB_OUTPUT}" - name: simple-tag-and-release - uses: sbe-arg/simple-tags-and-releases@main + uses: sbe-arg/simple-tags-and-releases@84e09724a8eddf0fb8e01bedc91ab95f142d203d # v0.2.0 with: autogenerated_notes: 'true' version_file: 'folder/sub-folder/file-name' - upload_file: ${{ steps.tar.outputs.tar }} + upload_file: ${{ steps.tar.outputs.tar/orSomeFile }} env: GH_TOKEN: ${{ github.token }} ``` - ## what for: simple release processes -- non automated versioning, tags and releases based on content of a file -- upload a single tar to the release - -## what not: try to keep it simple - -- no support for pre_releases -- no automatic semantic versioning +- versioning from a file source +- upload a single file to the release ## what does it look like - runs: [link](https://github.com/sbe-arg/simple-tags-and-releases/actions/workflows/simple.yml) - releases: [link](https://github.com/sbe-arg/simple-tags-and-releases/releases) - tags: [link](https://github.com/sbe-arg/simple-tags-and-releases/tags) + +## safeguards + +- exit `0` if the tag already exists +- exit `1` if the version in file is not semver valid. Uses [semver-tool](https://github.com/fsaintjacques/semver-tool) + +## extras + +- if you want a version bump reminder in your prs, you can use this [example](https://github.com/sbe-arg/simple-tags-and-releases/blob/main/.github/workflows/version-reminder.yml) \ No newline at end of file diff --git a/VERSION b/VERSION index 81fd7ba..d4dfa56 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.2.0 \ No newline at end of file +v0.3.0 \ No newline at end of file diff --git a/action.yml b/action.yml index a16f84e..8f40354 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,16 @@ runs: autogenerated_notes=${{ inputs.autogenerated_notes }} upload=${{ inputs.upload_file }} + # Verify the version in file is semver + wget -O ./semver \ + https://raw.githubusercontent.com/fsaintjacques/semver-tool/837ad91179c4126e3b7ff73c35091d5ef561d9a3/src/semver # v3.4.0 + chmod +x ./semver + version_validate=$(./semver validate "$version") + if [ "$version_validate" = 'invalid' ]; then + echo "Version [$version] is invalid." + exit 1 + fi + # If the tag exists for that version, do nothing if git rev-parse "$version" >/dev/null 2>&1; then echo "Tag $version already exists."