Skip to content

Commit

Permalink
feat: verify semver is valid inside the version_file + readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sbe-arg committed Jul 14, 2023
1 parent d3847ea commit 9baefd6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
contents: write
steps:

- uses: actions/checkout@v3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: '0'

Expand All @@ -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)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.0
v0.3.0
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 9baefd6

Please sign in to comment.