Skip to content

Commit

Permalink
Update cd.workflow.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbjihan committed Dec 7, 2024
1 parent 5538393 commit 5584777
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions .github/workflows/cd.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,67 +18,6 @@ jobs:

- run: git fetch --tags origin

- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: v1.0.0

- name: Determine next version
id: next-version
run: |
latest_tag=${{steps.previoustag.outputs.tag}}
echo "Latest tag: $latest_tag"
if [[ $latest_tag =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
source_branch="${{ github.event.pull_request.head.ref }}"
echo "Source branch: $source_branch"
if [[ $source_branch == dev* ]]; then
minor=$((minor + 1))
patch=0
elif [[ $source_branch == hotfix* ]]; then
patch=$((patch + 1))
else
echo "Unknown source branch prefix: $source_branch"
exit 1
fi
new_tag="v${major}.${minor}.${patch}"
echo "New tag: $new_tag"
echo "NEW_TAG=$new_tag" >> $GITHUB_ENV
else
echo "No valid previous tag found. Exiting."
exit 1
fi
- name: Create new tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
new_tag=${{ env.NEW_TAG }}
echo "Creating new tag: $new_tag"
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git tag $new_tag
git push origin $new_tag
- name: Create a Release
run: |
new_tag=${{ env.NEW_TAG }}
echo "Creating release for tag: $new_tag"
curl -X POST https://api.github.com/repos/${{ github.repository }}/releases \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"tag_name": "'"$new_tag"'","name": "'"$new_tag"'","body": "Release description for '"$new_tag"'","draft": false,"prerelease": false}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create .env file
run: |
echo VITE_DOMAIN=${{ secrets.VITE_DOMAIN }} >> .env
Expand Down

0 comments on commit 5584777

Please sign in to comment.