Skip to content

Commit

Permalink
Merge pull request #438 from LerianStudio/fix/package-manager-05
Browse files Browse the repository at this point in the history
fix: var version with error 🐛
  • Loading branch information
maxwelbm authored Dec 27, 2024
2 parents cf4635a + 0a64bf8 commit 9f51810
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
52 changes: 25 additions & 27 deletions .github/workflows/packages-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -83,9 +82,8 @@ jobs:
exit 1
}
$version = $env:version
Write-Host "Updating nuspec version to $version"
(Get-Content $nuspecPath) -replace '<version>.*</version>', "<version>$version</version>" | Set-Content $nuspecPath
Write-Host "Updating nuspec version to ${{ needs.get_branch.outputs.version }}"
(Get-Content $nuspecPath) -replace '<version>.*</version>', "<version>${{ needs.get_branch.outputs.version }}</version>" | Set-Content $nuspecPath
shell: pwsh

- name: Download and extract ZIP
Expand All @@ -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
Expand Down Expand Up @@ -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
4 changes: 3 additions & 1 deletion chocolatey/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''

Expand Down

0 comments on commit 9f51810

Please sign in to comment.