-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aldo W.
committed
Jan 28, 2024
1 parent
b805c5b
commit 5d30b15
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Create version tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
env: | ||
TAG_VERSION: v0.0.0 | ||
PREVIOUS_TAG: 0.0.0 | ||
LATEST_TAG: 0.0.0 | ||
SHELL_SCRIPT_VERSION: 0.0.0 | ||
jobs: | ||
create_tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check the latest version | ||
run: | | ||
all_tags=$(git tag | sort -rV) | ||
read -ra all_tags_vector <<< "$all_tags" | ||
latest_tag_version="${all_tags_vector[0]#v}" | ||
shell_script_version=$(grep -i -E '^# version\s*=\s*"[0-9]+\.[0-9]+\.[0-9]+"' archcrystal.sh | \ | ||
grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') | ||
echo "SHELL_SCRIPT_VERSION=${shell_script_version}" >> $GITHUB_ENV | ||
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } | ||
if [ $(shell_script_version#v) -ge $(latest_tag_version) ]; then | ||
echo "NEW_TAG_FLAG='1'" >> $GITHUB_ENV | ||
echo "::set-output name=tag-created::1" | ||
fi | ||
- uses: butlerlogic/action-autotag@1.1.2 | ||
if: ${{ env.NEW_TAG_FLAG != '0' }} | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
with: | ||
strategy: regex | ||
root: archcrystal.sh | ||
regex_pattern: $SHELL_SCRIPT_VERSION | ||
tag_prefix: v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters