Skip to content

Commit

Permalink
Fix CD error
Browse files Browse the repository at this point in the history
Add a step to delete existing tags before creating a new release to avoid the 'Validation Failed: already_exists' error.

* **.github/workflows/cd.yml**
  - Add a new step to delete the existing tag if it already exists before creating a new release.
  - Use the `git tag -d` and `git push --delete origin` commands to delete the existing tag.

* **README.md**
  - Update the CD pipeline description to include the new step for deleting existing tags if they already exist before creating a new release.
  • Loading branch information
hootanht committed Sep 12, 2024
1 parent c7d997a commit b5133b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ jobs:
id: get_version
run: echo "::set-output name=version::$(dotnet run --project ./PrsianDate/PrsianDate.csproj --configuration Release --no-build --no-restore)"

- name: Delete existing tag if it exists
id: delete_tag
run: |
if git rev-parse "v${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
git tag -d "v${{ steps.get_version.outputs.version }}"
git push --delete origin "v${{ steps.get_version.outputs.version }}"
fi
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The CI pipeline is defined in `.github/workflows/ci.yml` and uses `macos-latest`

## CD Pipeline

The CD pipeline is defined in `.github/workflows/cd.yml` and uses `macos-latest` as the VM image. It restores NuGet packages, builds the solution, runs tests, and publishes the NuGet package. The pipeline installs .NET version 8.0.x to ensure compatibility with all targeted frameworks.
The CD pipeline is defined in `.github/workflows/cd.yml` and uses `macos-latest` as the VM image. It restores NuGet packages, builds the solution, runs tests, and publishes the NuGet package. The pipeline installs .NET version 8.0.x to ensure compatibility with all targeted frameworks. Additionally, it includes a step to delete existing tags if they already exist before creating a new release to avoid the 'Validation Failed: already_exists' error.

## Developer [![Twitter Follow](https://img.shields.io/twitter/follow/hootanht?style=social)](https://twitter.com/hootanht)

Expand Down

0 comments on commit b5133b4

Please sign in to comment.