Skip to content

Commit

Permalink
ci: skip trying to push an already pushed version (#1273)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal authored Mar 15, 2024
1 parent 074044a commit 4fa1cbf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release-chocolatey.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,37 @@ jobs:
echo "Setting version to $version"
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Check if this is a new version to release
id: check_new_version
run: |
$output = choco search asyncapi-cli --version=${{ steps.release_version.outputs.version }}
# Output is of the form:
# Chocolatey v2.2.2
# asyncapi-cli 0.0.1 [Approved]
# 1 packages found.
# If the version is not found, the output will of the form:
# Chocolatey v2.2.2
# 0 packages found.
if ($output -match "0 packages found.") {
echo "This is a new version to release"
echo "new_version=true" >> $env:GITHUB_OUTPUT
}
else {
echo "This is not a new version to release"
echo "new_version=false" >> $env:GITHUB_OUTPUT
}
- name: Download release
if: steps.check_new_version.outputs.new_version == 'true'
run: |
echo "Downloading release assets for version ${{ steps.release_version.outputs.version }}"
mkdir -p ./dist/win32
curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x64.exe" -o "./dist/win32/asyncapi.x64.exe"
curl -L "https://github.com/asyncapi/cli/releases/download/v${{ steps.release_version.outputs.version }}/asyncapi.x86.exe" -o "./dist/win32/asyncapi.x86.exe"
- name: Get Checksum of the release
if: steps.check_new_version.outputs.new_version == 'true'
id: release_checksum
run: |
$checksum = (Get-FileHash -Path "./dist/win32/asyncapi.x86.exe" -Algorithm SHA256).Hash
Expand All @@ -51,11 +74,13 @@ jobs:
echo "checksum64=$checksum64" >> $env:GITHUB_OUTPUT
- name: Make nuspec from the template
if: steps.check_new_version.outputs.new_version == 'true'
run: |
cd ./.github/workflows/deploy/chocolatey
pwsh -File ./replace.ps1 -version ${{ steps.release_version.outputs.version }} -checksum ${{ steps.release_checksum.outputs.checksum }} -checksum64 ${{ steps.release_checksum.outputs.checksum64 }}
- name: Run Chocolatey Pack
if: steps.check_new_version.outputs.new_version == 'true'
run: |
cd ./.github/workflows/deploy/chocolatey
choco pack ./asyncapi-cli.nuspec
Expand Down

0 comments on commit 4fa1cbf

Please sign in to comment.