diff --git a/.github/workflows/packages-manager.yml b/.github/workflows/packages-manager.yml index 5dfa5860..768b345b 100644 --- a/.github/workflows/packages-manager.yml +++ b/.github/workflows/packages-manager.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-24.04 outputs: is_main: ${{ steps.verify_branch.outputs.is_main }} + version: ${{ steps.verify_branch.outputs.version }} steps: - uses: actions/checkout@v4 @@ -29,20 +30,30 @@ jobs: echo "is_main=false" >> $GITHUB_OUTPUT fi + version=$(echo "$RAW_RELEASE" | sed 's/^v//') + echo "version=$version" >> $GITHUB_OUTPUT - brew_release: + wait_release: needs: get_branch runs-on: ubuntu-24.04 - if: needs.get_branch.outputs.is_main == 'true' steps: - - name: Update Homebrew Formula - uses: dawidd6/action-homebrew-bump-formula@v4 - with: - token: ${{ secrets.RELEASE_GITHUB_TOKEN }} - formula: mdz + - name: Wait for 10 minutes + run: sleep 600 + + # NOTE: our cli is in homebrew's autobump.txt because it has been updated so much + # brew_release: + # needs: [get_branch, wait_job] + # runs-on: ubuntu-24.04 + # if: needs.get_branch.outputs.is_main == 'true' + # steps: + # - name: Update Homebrew Formula + # uses: dawidd6/action-homebrew-bump-formula@v4 + # with: + # token: ${{ secrets.RELEASE_GITHUB_TOKEN }} + # formula: mdz chocolatey_release: - needs: get_branch + needs: [get_branch, wait_release] runs-on: windows-latest if: needs.get_branch.outputs.is_main == 'true' steps: @@ -55,18 +66,6 @@ jobs: app-id: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_APP_ID }} private-key: ${{ secrets.LERIAN_STUDIO_MIDAZ_PUSH_BOT_PRIVATE_KEY }} - - name: Fetch Latest Tag - id: latest_tag - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - $RawRelease = gh release list --repo $env:GITHUB_REPOSITORY --limit 1 --json tagName --jq '.[0].tagName' - $FormattedRelease = $RawRelease -replace '^v', '' - Write-Host "Formatted release: $FormattedRelease" - - echo "version=$FormattedRelease" >> $env:GITHUB_ENV - shell: pwsh - - name: Set up Chocolatey run: | Set-ExecutionPolicy Bypass -Scope Process -Force @@ -83,9 +82,8 @@ jobs: exit 1 } - $version = $env:version - Write-Host "Updating nuspec version to $version" - (Get-Content $nuspecPath) -replace '.*', "$version" | Set-Content $nuspecPath + Write-Host "Updating nuspec version to ${{ needs.get_branch.outputs.version }}" + (Get-Content $nuspecPath) -replace '.*', "${{ needs.get_branch.outputs.version }}" | Set-Content $nuspecPath shell: pwsh - name: Download and extract ZIP @@ -95,7 +93,7 @@ jobs: $zipFile = Join-Path $toolsDir 'mdz.zip' $outputFile = Join-Path $toolsDir 'mdz.exe' - $url = "https://github.com/LerianStudio/midaz/releases/download/v$($env:version)/midaz_$($env:version)_windows_amd64.zip" + $url = "https://github.com/LerianStudio/midaz/releases/download/v${{ needs.get_branch.outputs.version }}/midaz_${{ needs.get_branch.outputs.version }}_windows_amd64.zip" Write-Host "Downloading ZIP from $url to $zipFile" Invoke-WebRequest -Uri $url -OutFile $zipFile @@ -128,12 +126,12 @@ jobs: ls # install local test - choco install mdz --version=$env:version --prerelease --source="D:\a\midaz\midaz" + choco install mdz --version=${{ needs.get_branch.outputs.version }} --prerelease --source="D:\a\midaz\midaz" mdz version choco apikey --set $env:CHOCO_API_KEY - choco push mdz.$env:version.nupkg --source https://push.chocolatey.org/ + choco push mdz.${{ needs.get_branch.outputs.version }}.nupkg --source https://push.chocolatey.org/ # test install public mdz chocolatey - choco install mdz --version=$env:version --prerelease + choco install mdz --version=${{ needs.get_branch.outputs.version }} --prerelease mdz version diff --git a/chocolatey/tools/chocolateyinstall.ps1 b/chocolatey/tools/chocolateyinstall.ps1 index e3d0e969..a9c0aeb7 100644 --- a/chocolatey/tools/chocolateyinstall.ps1 +++ b/chocolatey/tools/chocolateyinstall.ps1 @@ -6,8 +6,10 @@ $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" $binDir = Join-Path $env:ChocolateyInstall 'bin' $outputFile = Join-Path $toolsDir 'mdz.exe' +$versionFmt = $version -replace '^v', '' + # URL do arquivo zipado -$url = 'https://github.com/LerianStudio/midaz/releases/download/v${version}/midaz_${version}_windows_amd64.zip' +$url = "https://github.com/LerianStudio/midaz/releases/download/"+$version+"/midaz_"+$versionFmt+"_windows_amd64.zip" $checksum = '{{CHECKSUM}}' $silentArgs = ''