Skip to content

Commit

Permalink
workflow: modified
Browse files Browse the repository at this point in the history
  • Loading branch information
forkimenjeckayang committed Jun 12, 2024
1 parent ff83828 commit b4d2644
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,36 @@ jobs:
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Check if tag exists
id: check_tag
- name: Check if tag exists locally
id: check_tag_local
run: |
if git rev-parse v1.0.0 >/dev/null 2>&1
then
echo "::set-output name=tag_exists::true"
echo "Tag exists locally"
echo "::set-output name=tag_exists_local::true"
else
echo "::set-output name=tag_exists::false"
echo "Tag does not exist locally"
echo "::set-output name=tag_exists_local::false"
fi
- name: Check if tag exists remotely
id: check_tag_remote
run: |
if git ls-remote --tags origin | grep refs/tags/v1.0.0 >/dev/null 2>&1
then
echo "Tag exists remotely"
echo "::set-output name=tag_exists_remote::true"
else
echo "Tag does not exist remotely"
echo "::set-output name=tag_exists_remote::false"
fi
- name: Create Tag
if: steps.check_tag.outputs.tag_exists == 'false'
if: steps.check_tag_local.outputs.tag_exists_local == 'false' && steps.check_tag_remote.outputs.tag_exists_remote == 'false'
run: git tag v1.0.0 # Replace with your desired tag name

- name: Push Tag
if: steps.check_tag.outputs.tag_exists == 'false'
if: steps.check_tag_local.outputs.tag_exists_local == 'false' && steps.check_tag_remote.outputs.tag_exists_remote == 'false'
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
Expand Down

0 comments on commit b4d2644

Please sign in to comment.